Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Compound PK
Message
 
 
To
24/01/2003 18:41:16
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00745314
Message ID:
00745316
Views:
21
This message has been marked as the solution to the initial question of the thread.
You can use correlated query.
SELECT * FROM table1 t1 ;
  WHERE NOT EXISTS (SELECT * from table2 t2 WHERE t2.key1 = t1.key1 AND t2.key2 = t1.key2)
>Hello, everyone
>
>It's about a MSSQL2k database. Some of the tables (used as junction tables) don't have a PK, but a compound pk, on two columns. My problem is now I have to find which records are in one table and aren't in another. This is a good candidate for a subselect
>
select pk from table1 where pk not in (select pk from table2)
>. Well... I have two columns. How to say that? select col1,col2 from table1 where pk1,pk2....somebody stop me, I'm already laughing :0
>
>
>Seriously, can anyone help me in this issue? (changing the tables is out of question)
>
>Thank you.
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform