开发者

Find the next month for given date in mysql

开发者 https://www.devze.com 2023-02-20 01:49 出处:网络
Find the COUNT(next month Between next month +2DAYS)for the created date in table(including Year wise Dec ,Jan like)

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 da开发者_JAVA百科te 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


SELECT COUNT(whatever)
FROM
yourTable
WHERE
yourDateColumn BETWEEN NOW()+INTERVAL 1 MONTH AND NOW()+INTERVAL 1 MONTH + INTERVAL 2 DAYS
0

精彩评论

暂无评论...
验证码 换一张
取 消