`

数据库行列转换

阅读更多
select  c.groupID,c.groupName ,
sum( case b.status when 1  then 1  else 0 end) as offine,
sum(case b.status when 2 then 1 else 0 end) as black
from T_LogicChannelInfo a
left outer join T_ChannelInfo b on a.ChannelID = b.ChannelID
left outer join T_GroupInfo c on a.GroupId=c.GroupID 
group by c.groupID
having (offine>0) or (black>0)
order by c.groupID
1
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics