数据库查询语句

DB 查询某一时间段内某个字段的数量和的最大值。
比如说
这里写图片描述

大体意思就是 在2017年11月份内的 s_flag是0000的最多的是有多少?
select max(a) max from (select count(s.s_flag) a,s.s_data data
from student s where s.s_flag =’0000’
and s.s_data between ‘2017-11-01’ and ‘2017-11-30’
group by s.s_data ) c ;

猜你喜欢

转载自blog.csdn.net/qq_15623599/article/details/78442061