最新消息:

按日期分组统计的例子

MSSQL admin 327浏览 0评论

111

/****** Script for SelectTopNRows command from SSMS ******/
SELECT CONVERT(varchar(100), xfsj, 23) thedate ,sum(xfje) themoney,count(*) therenci
FROM [yifeiic].[dbo].[lssj] where xfzl=’消费’ and (xffs<>’菜单消费’ ) group by CONVERT(varchar(100), xfsj, 23) order by thedate asc

 

SELECT CONVERT(varchar(100), xfsj, 23) sday ,sum(xfje) zk FROM [yifeiic].[dbo].[lssj] where (xfzl=’增款’ or xfzl=’减款’)  and xffs<>’开户押金’ and xfsj between ‘2015-04-03 00:00:00′ and ‘2015-05-03 23:59:59′  group by CONVERT(varchar(100), xfsj, 23) order by sday asc

转载请注明:中国翼通 » 按日期分组统计的例子


分享到:
已有 0 条评论