→ chunhsiang:union all 是重點吧 他可以將重複的視為不一樣的 08/31 18:40
※ 引述《phreat (雷)》之銘言:
: 請問一下
: 以下為兩張表
: table a
: id enable
: 1
: 2 1
: 3 1
: 4 1
: table b
: id enable
: 4 1
: 5 1
: 6 1
: 請問有辦法印出
: id enable
: 2 1
: 3 1
: 4 1
: 4 1
: 5 1
: 6 1
: 測試過FULL JOIN , UNION 等都無法達成如果使用
: select * from a as a ,b as b
: 會變成
: id enable id enable
: ....
: ....
: ....
: ....
select a.id as id, a.enable as enable
from a
where a.enable is not null
union all
select b.id, b.enable
from b
where b.enable is not null
;
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.37.103.210