Nicholas,
Your code certainly looks OK. Here's a sample using real tables and fields. It worked fine, giving me the correct 5 records.
SELECT coid from coheader where coid NOT IN ;
(SELECT cd_coid from codetail WHERE !cdid = cd_coid) ;
into cursor atemp
The only thing I can think of is to put the code into a single string to see if you have an extra comma or missing semicolon.
Barbara
>I have two similar tables and would like to retrieve all records in the first that are NOT IN the second. In Foxpro 2.6 I used to write statements like:
>
> SELECT tb1_PK FROM table1 WHERE tb1_PK NOT IN ;
> (SELECT tb2_PK FROM table2 ;
> WHERE somecondition ) ;
> INTO CURSOR temp
>
>
>This style doesn't work in VFP 6.0. I have tried all kinds of combinations but I either get a syntax error or required object is missing.
>
>How do I specify this correctly?