Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL - in table a, but not table b
Message
 
 
To
02/03/2009 23:42:10
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Pro
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01385157
Message ID:
01385159
Views:
68
>Another sql question: How would one say "In table A, but not in table B" in sql?
>thanks, Randy
select tableA.* from TableA T1 LEFT JOIN  TableB T2 on T1.PK = T2.FK where T2.FK IS NULL
this usually performs better than
select * from TableA where PK not in (select FK from TableB)
See interesting discussion at
http://blog.sqlauthority.com/2008/04/22/sql-server-better-performance-left-join-or-not-in/
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform