欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

sql 语句实现根据日期字段计算总营业额的查询

程序员文章站 2022-04-26 13:32:13
...

1.实例:

	<!-- 计算每天营业总额 -->
	<select id="getDayPay" resultType="Customer">
		select check_out, sum(pay) sum  from customer group by check_out
	</select>
	<!-- 计算每月营业总额 -->
	<select id="getMonthPay" resultType="Customer">
		select check_out, sum(pay) sum  from customer group by month(check_out) order by check_out
	</select>
	
	<!-- 计算每年营业总额 -->
	<select id="getYearPay" resultType="Customer">
		select check_out, sum(pay) sum  from customer group by year(check_out) order by check_out
	</select>

2.对每条数据到数据库中测试的结果:

sql 语句实现根据日期字段计算总营业额的查询

sql 语句实现根据日期字段计算总营业额的查询

相关标签: sql sms