Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Combine and remove duplicate
Message
 
To
02/07/1999 23:31:17
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00237126
Message ID:
00237131
Views:
14
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform