There are two sample tables.
select * from info;
select * from info1;
join
select * from info
join info1
on info.ID = info1.no;
the join is to make the same condition both tables based on ID
select * from info
left join info1
on info.ID = info1.no;
The left join is the second table will be into the first table.
union
select cc.code
from info1 as cc
union all
select dd.code
from info as dd;
'union all' includes all values. 'union' ignores the same values.
the number of columns should be same.
select ID, Ecode , day_time
from info
union all
select *
from info1;
'SQL' 카테고리의 다른 글
[mysql] concat, substring, if, case, case + if (0) | 2020.07.15 |
---|---|
[mysql] Subbranch, group by, having, rollup (0) | 2020.07.02 |
SQL (0) | 2020.06.17 |