I want so select all records from the previous month, using a Mysql-query.
For the moment i've made something like this:
$query = "SELECT * FROM tabel WHERE MONTH(datum) = MONTH(DATE_SUB(NOW(), INTERVAL 1 MONTH))";
But as you can see this won't work perfect. For example: in januari it won't select the records from december, and so on.
Can anybody help me out? The date are stored in a datetime-field called 'datum'.