标签:order by name string class str stat ext 技术 access
1:按照月份分类查询
select substr(b.deliver_date,1,7), sum(b.cost) from business_bill b where b.deliver_date like ‘2017%‘ group by substr(b.deliver_date,1,7);
2:进馆人次统计
select convert(varchar(7),c.f_ReadDate,121),b.DPNAME1,COUNT(*) --DATENAME(year,c.f_ReadDate)+‘-‘+DATENAME(month,c.f_ReadDate), DPNAME1) --,a.CUSTDEPT,a.scardsnr,a.name --,c.f_CardNO from [172.16.8.1].TransDbtsg.dbo.BASE_CUSTOMERS a ,[172.16.8.1].TransDbtsg.dbo.BASE_CUSTdept b ,[AccessData].dbo.t_d_SwipeRecord c where substring(a.CUSTDEPT+‘000000000000‘,1,12) =b.dpcode1+b.dpcode2+b.dpcode3+b.dpcode4 and [AccessData].dbo.check01 (scardsnr)=1 and c.f_Status=1 and [AccessData].dbo.Backcha(a.scardsnr)=c.f_CardNO and c.f_ReadDate >‘2017‘ group by convert(varchar(7),c.f_ReadDate,121),b.DPNAME1 order by convert(varchar(7),c.f_ReadDate,121),b.DPNAME1
标签:order by name string class str stat ext 技术 access
原文地址:http://www.cnblogs.com/test1234/p/7657693.html