日期:2014-05-17 浏览次数:20533 次
select ww.*,qq.renshu from (select a.*,b.mingcheng,c.mingma,d.mingcheng as mch,e.mingcheng as pl,f.DFMingCheng as zj from Tbl_checkIn a, tbl_diqu b,tbl_ShouPiao c,tbl_YanPiaoDian d,tbl_PiaoLei e,Tbl_SFZ f where a.diqu=b.bianhao and a.KaHao=c.kahao and a.CheckInNo=d.bianhao and left(a.zhengjian,6)=f.SFZBianHao and a.piaolei=e.bianhao and mingma>='55622' and mingma<='55634' and convert(char(10),CheckInTime,120) >= '20120615' and convert(char(10),CheckInTime,120) <= '20120625') ww join (select zhengjian,sum(renshu) as renshu from tbl_checkin group by zhengjian) qq on ww.zhengjian =qq.zhengjian