查下昨天下午4点到现在 青岛3000占总3000的处理比例

 

 

    查下昨天下午4点到现在 青岛3000占总3000的处理比例   select count (*) from do_log with(nolock ) where createtime between '20151012 16:00:000' and '20151013 13:00:000'  and  ( driverId like '132-%' or driverId like '133-%' ) select count (*)  from do_log with(nolock ) where createtime between '20151012 16:00:000' and '20151013 13:00:000'  and ( driverId like '132-%' or driverId like '133-%' or driverId like '120-%'or driverId like '121-%'or driverId like '122-%'or driverId like '129-%' or driverId like '130-%'or driverId like '131-%'or driverId like '128-%'or driverId like '124-%'or driverId like '125-%' ) select 14899.0/ 33501   select cast (sum( case when left(driverid ,4) in('132-' ,'133-') then 1 else 0 end )*100.0/ count(*) as decimal (10, 2)) '百分比' ,count(*) '总笔数'  from do_log with( nolock) where createtime between '20151012 16:00:000' and '20151013 13:00:000'   and ( driverId like '132-%' or driverId like '133-%' or driverId like '120-%'or driverId like '121-%'or driverId like '122-%'or driverId like '129-%' or driverId like '130-%'or driverId like '131-%'or driverId like '128-%' or driverId like '124-%'or driverId like '125-%' )   select cast (sum( case when left(driverid ,4) in('132-' ,'133-') then 1 else 0 end )*100.0/ count(*) as decimal (10, 2)) '百分比' ,count(*) '总笔数'  from do_log with( nolock) where createtime between '20151012 16:00:000' and '20151013 13:00:000' and callerid=3000            再统计下,每个小时的占比    select  convert(varchar (13), createtime,20 ) '时间' ,cast( sum(case when left(driverid, 4) in('132-', '133-') then 1 else 0 end )*100.0/ count(*) as decimal (10, 2)) '百分比',count (*) '总笔数' from do_log with (nolock) where createtime between '20151012 16:00:000' and '20151013 13:00:000' and callerid=3000 group by convert(varchar (13), createtime,20 )  order by convert (varchar( 13),createtime ,20)    select convert(varchar (13), createtime,20 ) '时间' ,cast( sum(case when left(driverid, 4) in('132-', '133-') then 1 else 0 end )*100.0/ count(*) as decimal (10, 2)) '百分比',count (*) '总笔数'   from do_log with (nolock) where createtime between '20151012 16:00:000' and '20151013 13:00:000'   and ( driverId like '132-%' or driverId like '133-%'or driverId like '120-%'or driverId like '121-%' or driverId like '122-%'or driverId like '129-%'or driverId like '130-%' or driverId like '131-%'or driverId like '128-%'or driverId like '124-%' or driverId like '125-%' ) group by convert( varchar(13 ),createtime, 20)  order by convert( varchar(13 ),createtime, 20)
上一篇:mock 模拟数据在框架中的简单使用


下一篇:项目部署服务器