EasyCFM.COM ColdFusion Forums / Coding Help! / query assistance needed

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: query assistance needed

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

ElBeginner
09-16-2004 @ 10:37 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Junior Member
Posts: 68
Joined: Jun 2004

I have two table that contain a field called division_id and one that contains a field divname.  I want to find out whether all value from the first table that are not existant on the second table.

i.e. notice 3 4 6 are not ids found on table two.  I want the query to give me this information by giving me the div name.

table one divisions ids        table two division ids

1                                 1
2                                 2
3                                 5
4
5
6

this is what i have that doesnt work

     <cfquery name="get_obd_data" datasource="#application.obd_ds#">
          select * from branches a join division b
          on a.division_id=b.division_id
          where b.division_id = null
     
          
     </cfquery>




deepu_verma
09-16-2004 @ 12:05 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 1
Joined: Sep 2004

Hi,
Try using this query
<cfquery name="get_obd_data" datasource="#application.obd_ds#">
          select * from branches
          where  division_id not in (select division_id  from division)
     </cfquery>
Hope this suffices your problem


Website Designed and Developed by Pablo Varando.