0
我想知道某個日期是befere還是在一個表中的一個字段後。所以我寫了兩個查詢來測試它。在sql數據庫返回null的Datediff查詢
首先是這樣的:
SELECT * FROM tasks WHERE name='Tareas';
這讓我:
+--------+----------+-----------------------+------------+-------------+----------------------------+-----------+---------+-------+
| name | user | proyect | start_date | update_date | description | status | percent | keyid |
+--------+----------+-----------------------+------------+-------------+----------------------------+-----------+---------+-------+
| Tareas | spruebas | Y otro proyectito mas | 2014-09-18 | 2014-09-18 | Para que vea algo el pobre | Pendiente | 0 | 5 |
+--------+----------+-----------------------+------------+-------------+----------------------------+-----------+---------+-------+
於是我嘗試用這個測試查詢:
SELECT DATEDIFF('2014-10-09','update_date') AS pepe FROM tasks WHERE name='Tareas';
然而,這將返回佩佩爲NULL。我究竟做錯了什麼?我不應該得到日期的差異(正面還是負面)?我知道日期格式是相同的。
非常感謝您!它現在工作了! – aarelovich 2014-10-09 16:53:34