Monday, November 29, 2021

WHERE Clause to find all records in a specific month

id postdate
-- ----------------
1  2020-01-01 12:08
2  2020-02-01 12:00
3  2020-01-12 09:40
4  2020-01-29 17:55
SELECT id FROM `myPost` 
   WHERE MONTH(postDate) = 1 AND YEAR(postDate) = 2020

No comments:

Post a Comment