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

来源:互联网 发布:网络作家花千骨作者 编辑:程序博客网 时间:2024/06/07 00:00

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月份出现最大日期的数据

0 0