日期:2014-05-17 浏览次数:20555 次
select a.piaolei,a.renshu,b.mingcheng as pl from Tbl_checkIn a,tbl_PiaoLei b where a.piaolei=b.bianhao and convert(char(10),CheckInTime,120) >= '2012-08-16' and convert(char(10),CheckInTime,120) <= '2012-08-16' and CheckInNo='01'
select sum(case when b.mingcheng='北京' then a.renshu else 0 end) '北京人数',sum(case when b.mingcheng='上海' then a.renshu else 0 end) '上海人数' from Tbl_checkIn a,tbl_PiaoLei b where a.piaolei=b.bianhao and convert(char(10),CheckInTime,120) >= '2012-08-16' and convert(char(10),CheckInTime,120) <= '2012-08-16' and CheckInNo='01'