Select data from two tables with identical columns

I have two tables that have the same structure; one contains persistent data, and one is cleared and reset on a regular basis.

I need to do the same select action as for them, as if they were only one table

This is what I tried:

SELECT * FROM a, bWHERE 1;

Where athey bhave the same structure;

+5
source share
2 answers

Perhaps you are looking at using UNION in a query:

Select * from a
UNION
Select * from b

. * . , , , .

+8

, , ? , - :

select a.col1, a.col2 from a where...
UNION
select b.col1, b.col2 from b where...

mysql union

+3

All Articles