How can I select Current Month records from a table of MySql database??
Like now current month is January. I would like to get records of January Month, Where data type of my table column is timestamp
.I would like to know the sql query.
Thanks
Try this query:
SELECT *
FROM table
WHERE MONTH(FROM_UNIXTIME(columnName))= MONTH(CURDATE())
Check the MySQL Datetime Functions:
Try this:
SELECT *
FROM tableA
WHERE YEAR(columnName) = YEAR(CURRENT_DATE()) AND
MONTH(columnName) = MONTH(CURRENT_DATE());
Source: Stackoverflow.com