Reputation: 31
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
Upvotes: 3
Views: 17039
Reputation: 51868
SELECT COUNT(whatever)
FROM
yourTable
WHERE
yourDateColumn BETWEEN NOW()+INTERVAL 1 MONTH AND NOW()+INTERVAL 1 MONTH + INTERVAL 2 DAYS
Upvotes: 2
Reputation: 5609
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
Upvotes: 11