Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Not in statement
Message
 
To
03/03/2004 09:55:04
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00882687
Message ID:
00882708
Views:
13
This message has been marked as a message which has helped to the initial question of the thread.
Tracy,

Consider this:
fld1    flag
001     .t.
001     .f.
* this will give you two records
Sele ... where IN (sele ... where flag)

* this will give you two records
Sele ... where IN (sele ... where NOT flag)

* this will give you NO records
Sele ... where NOT IN (sele ... where flag)

>The below works:
>
>
>SELECT cn_name, cn_port, cn_printer FROM lcontrol ;
>  WHERE !EMPTY(lcontrol.cn_name) .and. lcontrol.cn_name IN ;
>  (SELECT ctrlname FROM ctrlset WHERE ctrlset.printform = .T.);
>  INTO TABLE (hdir+"tTEMPLCONTROL.DBF")
>
>
>so does the reverse:
>
>
>SELECT cn_name, cn_port, cn_printer FROM lcontrol ;
>  WHERE !EMPTY(lcontrol.cn_name) .and. lcontrol.cn_name IN ;
>  (SELECT ctrlname FROM ctrlset WHERE ctrlset.printform = .F.);
>  INTO TABLE (hdir+"tTEMPLCONTROL.DBF")
>
>
>However, the reverse of the first using NOT does not work, any idea why anyone?
>
>
>SELECT cn_name, cn_port, cn_printer FROM lcontrol ;
>  WHERE !EMPTY(lcontrol.cn_name) .and. lcontrol.cn_name NOT IN ;
>  (SELECT ctrlname FROM ctrlset WHERE ctrlset.printform = .T.);
>  INTO TABLE (hdir+"tTEMPLCONTROL.DBF")
>
>
>The 2nd two statements should produce the same results, but they do not. What is wrong with the "not in" portion?
>
>TIA,
>Tracy
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform