日期:2014-05-17 浏览次数:20676 次
select max(rjsj)<'2014-01-04 00:00:00' from tableA
if (select max(rjsj) from tb)<'2014-01-11 23:59:59'
begin
select 0
end
else
begin
SELECT COUNT(*) FROM tableA
WHERE rjsj BETWEEN '2014-01-01 00:00:00' AND '2014-01-11 23:59:59'
end
SELECT case when max(rjsj) < '2014-01-11 23:59:59' then 0
else COUNT(case when rjsj BETWEEN '2014-01-01 00:00:00' AND '2014-01-11 23:59:59'
then 1
else null end)
end
FROM tableA