求一條SQL語句

時間 2022-10-03 13:15:03

1樓:匿名使用者

select *

from ((select * from 表 where 列2 is null) union

(select *

from 表

where 列2 is not null

and rownum <=

(100 - (case when (select count(*) from 表 where 列2 is null)<100 then (select count(*) from 表 where 列2 is null) else 100 end )

order by 列3 asc)) a

order by 列3 asc

2樓:匿名使用者

select top 100 * from table1 order by 列3 (asc/desc)

把列2的空值全部顯示出來 什麼意思,給點資料

3樓:奎解一沫布式

select top 100 * from table

where 列2 is null order by 列3

4樓:匿名使用者

select 列1,列2,列3 from table

where 列2 is null

order by 列3

求一條SQL語句

樓上兩位的都有問題。應該是 select a.tid,tkh,tname,sum t2a sum t2b from table1 a,table2 bwhere a.tid b.tid and tkh 50 group by a.tid,tkh,tname select table1.tid,tkh...

求一條SQL語句,有關聯合查詢的

試試看這樣行不行 select 表b 學號 表a 姓名 isnull sum case 表b 學科 when n 語文 then 表b 分數 end 0 as 語文 isnull sum case 表b 學科 when n 數學 then 表b 分數 end 0 as 數學 isnull sum c...

求SQL語句,按照不同條件分類統計想求一條sql語句,統計某個欄位數值之和,以及所佔百分比,比如

酒意何存 靠 你問題能在坑點嗎 第一個資料 pid c對應的 weight 是0 我說怎麼看怎麼不對呢 select sum case when flag 0 then weight else 0 end as flag0,sum case when flag 0 then weight else ...