誰能幫個忙寫個SQl語句

時間 2022-08-23 01:35:02

1樓:匿名使用者

什麼資料庫呢?

oracle /db2 /ms sql 2005以上可以這樣寫

假設表結構

tabfld1 fld2, fld3

select t1.fld1, t2.fld2, t1.fld3

from (select fld1, fld3, row_number() over(order by fld1) rk

from tab where fld1 is not null) t1 left join

(select fld2, row_number() over(order by fld2) rk

from tab where fld2 is not null) t2

on t1.rk = t2.rk

用fld1的左聯接就可以了

如果a null null

b null null

null c null

null d null

c d對應的最後一列為null的話,那上面這個就可以的。ab後面對應的資料都可以顯示出來的,不管你是null還是資料,你嘗試下

2樓:網上衝浪玩家

加入你的表的欄位是 id1 id2 表名為tid1 id2

a null

b null

null c

null d

select (select id1 from t where id1 is not null),(select id2 from t where id2 is not null) from t

3樓:

如果表為sjb欄位為x,y

select a.x,b.y from (select x from sjb where x<>null ) a,(select y from sjb where y<>null) b

兩個日語句型問題,高手幫個忙

1.中為什麼用 而不用 看來你對句子的成分還不夠了解。週末 在這裡是名詞的 副詞現象,就象英語裡的at介詞來表示是個時間點一樣,表示在某個時間點做某事。如 7時 在7點起床 當然 也可由於時間名詞後,但表示的是經由的時間 如 幸 歲月 過 曾度過了一段艱辛的歲月。總而言之 一般是在句中作狀語,而並非...

誰能幫個忙(很容易就能拿100積分)

moto重灌軟體要150大元!地址就在北京王府井的moto形象店就可以裝!重灌不要去找客服的,這個錢是可以省得。況且1200的話都是自己刷的。自己刷就可以,你是上的是網通的嗎?要是的話,哪天晚上你有時間,我們遠端控制下,我給你刷就行 前提,你有資料線 需要幫忙加我。行貨保期內的話刷機免費。出保的話,...

一個SQL語句的簡單問題,sql語句的問題?

select from student inner join sc on inner join course on where 課程1 and 課程2 回的 汗 怎麼不對?可記為 course cno,cname,cpno,ccredit cno為關鍵字。另外 要是樓主用的資料庫是sql serve...