Reputation: 755
I have two tables as describe bellow:
How can I perform a query to merge the duplicate data in table B, so I can get table C in which the records derived from table A and Table B?
Any help will by highly appreciated.. Thank You !
Upvotes: 1
Views: 173
Reputation: 263693
This can be done using UNION
SELECT ID, Value FROM TableA
UNION
SELECT ID, Value FROM TableB
if there is an extra table named TableC
and you want to insert the result of TableA
and TableB
, use INSERT INTO...SELECT
statement,
INSERT INTO TableC(ID, Value)
SELECT ID, Value FROM TableA
UNION
SELECT ID, Value FROM TableB
Or maybe you want to create a VIEW
CREATE VIEW TableC
AS
SELECT ID, Value FROM TableA
UNION
SELECT ID, Value FROM TableB
to call the View,
SELECT * FROM TableC
Upvotes: 1