Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL: Distinct, Group By, or Exists?
Message
From
05/06/2003 10:09:57
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00796420
Message ID:
00796692
Views:
14
>I would do it in one of two ways (in the order of my personal preferences)
>
SELECT PrimaryKey, DataItem ;
>  FROM TableA ;
>  WHERE PrimaryKey IN ( SELECT PrimaryKey FROM TableB WHERE Condition = .T.)
>*
>SELECT PrimaryKey, DataItem ;
>  FROM TableA ta ;
>  WHERE EXISTS ( SELECT * FROM TableB tb ;
>        WHERE ta.PrimaryKey = tb.PrimaryKey AND tb.Condition = .T.)
>
Would either of these or the options in the other thread work if TableB were a pre-existing view instead of a SELECT?

> You may want to take a look at recent discussion which one is faster. ?
> Re: How to use select... where EXISTS ... ? Thread #793069.

Still reading and digesting it. Thanks.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform