Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Select to compare two tables
Message
From
29/01/2022 19:53:09
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01683376
Message ID:
01683381
Views:
36
Here's the simplest way....if all you want are the ID numbers in Table A that don't exist in Table B...

SELECT ID_Number from TABLEA
EXCEPT
SELECT ID_Number from TABLEB

Now, if you want "all the columns" from table A, you can do this...

SELECT * FROM TABLEA WHERE ID_NUMBER IN
(SELECT ID_Number from TABLEA INSIDE_A
EXCEPT
SELECT ID_Number from TABLEB INSIDE_B )

Now....I'm assuming you don't have any NULL values for ID_Number (which, if it's a key identifier, you shouldn't).
If you somehow do, you'd need to put a few IF NOT NULL statements....
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform