Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL that list all recs from 1 table without match in 2nd
Message
From
08/09/2000 16:50:40
 
 
To
08/09/2000 16:46:15
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00414411
Message ID:
00414420
Views:
28
>>For simple explanation....
>>
>>I have two tables with these fields:
>>
>>MASTER
>>cname = char
>>
>>DETAIL
>>cname = char (match above cname)
>>dorder = date
>>
>>I need to create a list of all the MASTER records that DO NOT have a matching record in the detail.
>>I believe this should be a simple SQL select but I can't figure out how to get the joins / where clause
>>to work right so that I only get the MASTER records.
>>
>>HELP!!! Something simple and it's driving me nuts!!!
>
>Couple ways:
>

Sorry - you did give structures <g>
SELECT * ;
  FROM master ;
  WHERE cname NOT IN ;
  (SELECT cname FROM detail) ;
  INTO CURSOR cuNoMatch

or

SELECT * ;
  FROM master ;
  WHERE NOT EXISTS ;
  (SELECT * FROM detail WHERE detail.cname = master.cname) ;
  INTO CURSOR cuNoMatch
Insanity: Doing the same thing over and over and expecting different results.
Previous
Reply
Map
View

Click here to load this message in the networking platform