日期:2014-05-17 浏览次数:20645 次
select 用户,(select count(1) from A where 用户ID='5277' and 最后更新时间<>'') 记录数1,
count(distinct a.a_id)记录数2,
count(1) 记录数3,
sum(case when convert(varchar,b.提交时间,23)>='00:00:00'
and convert(varchar,b.提交时间,23)<'12:00:00' then 1 else 0 end) [0点到12点],
sum(case when convert(varchar,b.提交时间,23)>='12:00:00'
and convert(varchar,b.提交时间,23)<='23:59:59' then 1 else 0 end) [12点23点]
from A,B where a.a_id=b.a_id and a.最后更新时间<>''
select
(select count(1) from tba where userid=5277 ) [记录数1],
(select count(1) from tba where userid=5277 and isnull(lasttime,'')!='') [记录数2],
count(1)[记录3],
sum(case when convert(varchar(20),b.tjtime,114) between '00:00:00' and '12:00:00' then 1 else 0 end) [0点到12点],
sum(case when convert(varchar(20),b.tjtime,114) between '12:00:01' and '23:59:59' then 1 else 0&