查询一个月最后一天的总用户数,数据库中没有保存最好一天的数据,就查询本月数据库已存有的最后一天的数据

select total_user from a_user_no where date_time=(select max(date_time) from a_user_no  where
 ‘2013-05’+ "'=to_char(date_time,‘yyyy-mm’));

通过max 函数来去5月份出现最大日期的数据

原文地址:https://www.cnblogs.com/cynchanpin/p/7103036.html