Friday, February 1, 2013

Select Query Last Month Unix Timestamp In MySQL

Change [fields], [table] and [datefield] to suite your needs.

If your dates are not stored as Unix timestamps then you can remove the "from_unixtime" function wrapping [datefield]
select [fields] from [table] where from_unixtime([datefield]) >= DATE_SUB(NOW(), INTERVAL 1 MONTH);