如果数据库表中有涉及到金额的部分,很多时候都需要查询每个月最后一天数据。该语句是用来查询每个月最后一天的。
sql语句的写法:
select * from table(table写自己的表名称)
where date_format
(create_time,’%Y-%m-%d’) in
(LAST_DAY ( STR_TO_DATE (concat (#{current_time,jdbcType=VARCHAR},’-01′),’%Y-%m-%d’)),
LAST_DAY ( STR_TO_DATE (concat (#{current_time,jdbcType=VARCHAR},’-02′),’%Y-%m-%d’)),
LAST_DAY ( STR_TO_DATE (concat (#{current_time,jdbcType=VARCHAR},’-03′),’%Y-%m-%d’)),
LAST_DAY ( STR_TO_DATE (concat (#{current_time,jdbcType=VARCHAR},’-04′),’%Y-%m-%d’)),
LAST_DAY ( STR_TO_DATE (concat (#{current_time,jdbcType=VARCHAR},’-05′),’%Y-%m-%d’)),
LAST_DAY ( STR_TO_DATE (concat (#{current_time,jdbcType=VARCHAR},’-06′),’%Y-%m-%d’)),
LAST_DAY ( STR_TO_DATE (concat (#{current_time,jdbcType=VA
版权声明:本文为weixin_39610594原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。