Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Select to compare two tables
Message
 
 
À
29/01/2022 19:53:09
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01683376
Message ID:
01683382
Vues:
32
Again, thank you. The first SQL won't work since the value in ID_NUMBER could be the same for many rows. But some other columns are different. I will try your second approach. Although I thought that the SQL Select would have the actual column names.

I am trying to figure out an example and right now I can't think of any.

>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....
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform