Table A
A1 A2
1 1 2
2 2 2
3 1 3
Table B
A1 A2
1 3 3
2 1 4
3 4 1
4 5 0
Expected Result
Table C
A1 A2
1 1 2
2 2 2
3 1 3
4 3 3
5 1 4
6 4 1
7 5 0
Asked
Active
Viewed 122 times
0

Zaynul Abadin Tuhin
- 31,407
- 5
- 33
- 63

herbert ichama
- 81
- 1
- 12
-
check `UNION` operator – demo May 31 '19 at 08:59
-
Try https://stackoverflow.com/questions/12475850/sql-query-return-data-from-multiple-tables/12475851#12475851 – u07ch May 31 '19 at 09:00
-
If any of the answers helped you, consider marking it as the answer for future visitors of this question (done by clicking/marking the gray checkbox next to the answer). – tobypls Jun 11 '19 at 14:46
2 Answers
1
If you want possible duplicates to be in the output, use UNION ALL
:
SELECT A1, A2 FROM TableA
UNION ALL
SELECT A1. A2 FROM TableB
If you want duplicates to be grouped together, use UNION
:
SELECT A1, A2 FROM TableA
UNION
SELECT A1. A2 FROM TableB

tobypls
- 839
- 1
- 8
- 21
0
use union all
select a1,a2 from tbalea
union all
select a1,a2 from tbleb

Zaynul Abadin Tuhin
- 31,407
- 5
- 33
- 63