Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combine and remove duplicate
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00237126
Message ID:
00237131
Vues:
15
>Hi,
> I would like to combine 2 tables (with same structure) and remove duplicate record after query. How could I do so?
>
> I try :
> SELECT DISTICNT Card_ID, Status, Date FROM
> (SELECT * FROM Table1 UNION SELECT * FROM Table2)
>
>Any Suggestion?

If the data is the same and doesn't need to be checked (usually it does need checking so you need more involved processes to report on duplicates) you could try:

select card_id, status, date
from table1
union
select *
from table2
where card_id not in (select card_id from table1)

all the fields must match exactly or your union won't work.

Sarah
Sarah King
pcpropertymanager.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform