Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
HOWTO: Select records from other table's selection
Message
De
22/02/2005 08:01:42
 
 
À
22/02/2005 07:55:45
Aaron K. Y. Chu
Health & Care Co. Ltd.
Hong Kong, Hong Kong
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00989182
Message ID:
00989185
Vues:
21
>Dear ALL,
>
>Help is highly appreciated...
>
>I need to select records from a table based on another table selection like so:
>
>TableA
>Selected1
>tID
>tValue
>
>TableB
>tID
>tCode
>
>IF tableA.selected1 > 0, select representing tableA.tID from table B, how can I do it by SQL statement?!
>
>SELECT * FROM TableB LEFT OUTER JOIN table A ON tableB.tID = TableA.tID WHERE tableA.selected1 > 0
>
>however, it only graps one record from tableB with corresponding record in table A... what's wrong?!
>
>Aaron

Hello Aaron,

Would this give you the desired result set?
SELECT TableB.* 
  FROM TableB 
    WHERE TableB.tID IN ( SELECT TableA.tID FROM TableA WHERE tableA.selected1 > 0 )
Mike
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform