I have two tables(comparison & ajusted_cases). Both tables have equal number of columns(same column names as well) I just want the (adjusted_cases) table to be placed under (comparison) table. Like the second table is merged under the first table. Is there anyway to do it in sqlite?
Asked
Active
Viewed 51 times
1 Answers
0
You need UNION ALL
:
SELECT * FROM comparison
UNION ALL
SELECT * FROM ajusted_cases
The above query will probably return all rows of comparison
first and then all rows of ajusted_cases
, but there is no guarantee for that.
Just to be on the safe side, add another column that indicates from which table each row comes from and sort the results by that column:
SELECT *, 1 order_col FROM comparison
UNION ALL
SELECT *, 2 FROM ajusted_cases
ORDER BY order_col

forpas
- 160,666
- 10
- 38
- 76