Reputation: 39
I am trying to create a union with 3 tables that have the same column names. However, the queries tested seems not to be working.
The first query that I have used is the following:
Select * FROM table1
UNION ALL
SELECT * FROM table2
SELECT * FROM table3
UNION ALL
The second query used is the following:
SELECT *
FROM
(select * from table_1
),
(select * from table_2
),
(select * from table_3
)
Both of them are not working for me. Please someone can help me with this?
Upvotes: 0
Views: 2913
Reputation: 10172
This should work if columns are identical:
SELECT * FROM table1 UNION ALL
SELECT * FROM table2 UNION ALL
SELECT * FROM table3
Upvotes: 1