兩個(gè)無(wú)關(guān)聯(lián)條件的結(jié)果進(jìn)行拼接
2 回答

拉丁的傳說(shuō)
TA貢獻(xiàn)1789條經(jīng)驗(yàn) 獲得超8個(gè)贊
with t1 as (select 1 from dual),
t2 as (select 2 from dual)
select * from t1, t2

忽然笑
TA貢獻(xiàn)1806條經(jīng)驗(yàn) 獲得超5個(gè)贊
如果數(shù)據(jù)類型相似,可以使用as配合union來(lái)結(jié)合,例如
select c1 as a,c2 as b,null as c from t1 union
select cc1 as a,cc2 as b,cc3 as c from t2;
其中,使用null來(lái)確保連個(gè)select有相同的列數(shù).
前提是兩個(gè)select選擇的同一列的數(shù)據(jù)類型相似.
- 2 回答
- 0 關(guān)注
- 6845 瀏覽
添加回答
舉報(bào)
0/150
提交
取消