在mysql中查找给定日期的下个月 [英] Find the next month for given date in mysql

查看:310
本文介绍了在mysql中查找给定日期的下个月的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在表格中找到创建日期的COUNT(下个月+ 2DAYS下个月)

如何使用mysql查询执行此操作 查询数据类型为date和datetime的需求

解决方案

如果只需要MONTH,则使用SELECT MONTH('2011-03-28' + INTERVAL 1 MONTH)

DATE和DATETIME的工作原理相同(用您自己的SQL和列名替换我引用的实际日期).有关更多信息,请参考 http://dev.mysql.com/doc/refman/5.1 /en/datetime.html

Find the COUNT(next month Between next month +2DAYS) for the created date in table(including Year wise Dec ,Jan like)

How to do this using mysql query Query need for both datatype date and datetime

解决方案

If you only want the MONTH, then use SELECT MONTH('2011-03-28' + INTERVAL 1 MONTH)

Works the same for DATE and DATETIME (replace the actual date I quoted with your own SQL and column name). For more info you can refer to http://dev.mysql.com/doc/refman/5.1/en/datetime.html

这篇关于在mysql中查找给定日期的下个月的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆