I have inner-joined two tables on 1 column. As per the method, it'll join side by side. For example
there are two tables employee(id, date, department) employee_1(id, date, department)
Let's take the employee data below
id date department
1 2022-09-09 professor
2 2022-10-08 professor
3 2022-10-11 professor
3 2022-09-02 professor
And employee_1 table is below
id date department
1 2021-09-09 professor
2 2021-10-08 professor
3 2021-10-11 professor
3 2021-09-02 professor
4 2021-09-10 professor
If I inner join the above two tables with the below query
select employee.*, employee_1.* from employee
inner join employee_1
on employee.id = employee_.id
It'll return below table
id date department date
1 2022-09-09 professor 2022-09-09
2 2022-10-08 professor 2022-10-08
3 2022-10-11 professor 2022-10-11
3 2022-09-02 professor 2021-09-02
How to get the output like
id date department
1 2022-09-09 professor
2 2022-10-08 professor
3 2022-10-11 professor
3 2022-09-02 professor
1 2021-09-09 professor
2 2021-10-08 professor
3 2021-10-11 professor
3 2021-09-02 professor
How to get the above table as output?
CodePudding user response:
select id, date, department
from employee
union all
select id, date, department
from employee_1