2019-02-27
閱讀量:
859
SQL查詢
問題描述:

290 成功的次數(shù) 6 是失敗的次數(shù)
怎樣一個sql 查出來 并且按 sid 和 api分組,要求 不用UNION,不連表
解決方法:
select sid,api,
sum(case when flag=0 then count else 0 end) count1,
sum(case when flag=1 then count else 0 end) count2
from table
group by sid,api;






評論(0)


暫無數(shù)據(jù)
推薦帖子
0條評論
0條評論
0條評論
0條評論