sql 查询
时间:2014-02-26 18:02:01
收藏:0
阅读:368
根据状态获取各个状态汇总,如下图

实现
|
1
2
3
4
5
6 |
select provice, (select
count(*) from
[monitor] m where
state=0 and
m.provice=monitor.provice ) as
m1,(select
count(*) from
[monitor] m where
state=1 and
m.provice=monitor.provice) as
m2,(select
count(*) from
[monitor] m where
state=2 and
m.provice=monitor.provice) as
m3,(select
count(*) from
[monitor] m where
state=3 and
m.provice=monitor.provice) as
m4from [dbo].[monitor] group
by
provice |
原文:http://www.cnblogs.com/tomfang/p/3568179.html
评论(0)
