|
Hi guys,
Ive got the following:
mysql> SELECT id, created, status FROM incidents WHERE created > DATE_SUB(NOW(), INTERVAL 30 day);
+------+---------------------+--------+
| id | created | status |
+------+---------------------+--------+
| 1058 | 2011-04-27 11:22:19 | 0 |
| 1059 | 2011-05-10 10:16:06 | 0 |
| 1060 | 2011-05-20 03:33:03 | 0 |
| 1061 | 2011-05-24 14:28:55 | 1 |
+------+---------------------+--------+
Great, That gives me rows from the last month/30 odd days...
Anyway..
How can I pad dates that dont have rows? ( If this can be done in php .. how? )
Ie so it responds with:
mysql> SELECT id, created, status FROM incidents WHERE created > DATE_SUB(NOW(), INTERVAL 30 day);
+------+---------------------+--------+
| id | created | status |
+------+---------------------+--------+
| 1058 | 2011-04-27 11:22:19 | 0 |
| 1059 | 2011-05-10 10:16:06 | 0 |
| 1060 | 2011-05-11 03:33:03 | 0 |
| 1060 | 2011-05-12 03:33:03 | 0 |
| 1060 | 2011-05-13 03:33:03 | 0 |
| 1060 | 2011-05-1403:33:03 | 0 |
| 1060 | 2011-05-15 03:33:03 | 0 |
etc ( until a real row comes up )
| 1061 | 2011-05-24 14:28:55 | 1 |
+------+---------------------+--------+
|