Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL - SELECT and IN Subquery
Message
 
À
01/09/2005 10:26:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01045811
Message ID:
01045814
Vues:
17
Any other details? Perhaps you need to post here the entire code.
Will the following work for you?
CREATE TABLE table1 (key n(10))
CREATE TABLE table2 (key n(10))
INSERT INTO table2 VALUES (1)
INSERT INTO table1 VALUES (1)
INSERT INTO table1 VALUES (2)
INSERT INTO table1 VALUES (3)
SELECT table1.key FROM table1 ;
   WHERE table1.key NOT IN (SELECT table2.key FROM table2)

* for me it returns  2,3 as expected
>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?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform