Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL - SELECT and IN Subquery
Message
 
To
01/09/2005 10:26:08
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01045811
Message ID:
01045817
Views:
21
Denis,
This works for me:
CREATE CURSOR table1 (Key1 N(1))
CREATE CURSOR table2 (Key1 N(1))
INSERT INTO Table1 VALUES (1)
INSERT INTO Table1 VALUES (2)
INSERT INTO Table1 VALUES (3)

INSERT INTO Table2 VALUES (1)

SELECT Table1.Key1 FROM table1 WHERE Table1.Key1 NOT IN (SELECT Table2.Key1 FROM table2)
>Hello,
>I try to return key from table1 which has not reference in the table2.
>
>[Table1].key
>1
>2
>3
>
>[Table2].key
>1
>
>SELECT table1.key FROM table1 ;
> WHERE table1.key NOT IN (SELECT table2.key FROM table2)
>
>I want to query return
>[Query].key
>2
>3
>
>But I got nothing.... empty sql result.... why?
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform