「2012-02」で始まるmysqlのすべてのフィールドを選択するにはどうすればよいですか?
私が試したこと:
mysql> SELECT title,id FROM dle_post WHERE approve='1' AND date = '2012-02-13 21:35:00';
+-------------------------------------------------+----+
| title | id |
+-------------------------------------------------+----+
| test title | 7 |
+-------------------------------------------------+----+
mysql> SELECT title,id FROM dle_post WHERE approve='1' AND date='2012-02%';
Empty set, 2 warnings (0.00 sec)
mysql> SHOW WARNINGS;
+---------+------+-----------------------------------------------------------------+
| Level | Code | Message |
+---------+------+-----------------------------------------------------------------+
| Warning | 1292 | Incorrect datetime value: '2012-02%' for column 'date' at row 1 |
| Warning | 1292 | Incorrect datetime value: '2012-02%' for column 'date' at row 1 |
+---------+------+-----------------------------------------------------------------+