我有如下表:IFNULL並凝聚似乎不工作
SELECT * FROM calls LIMIT 10;
time |number |duration|calltype
2011-02-21 19:06:19|11243243569| NULL|missed
2010-07-12 17:47:14|11234123445| NULL|missed
2010-07-01 20:55:14|11234123459| 52|placed
2010-07-24 22:43:53|12342345662| 363|received
2010-07-22 01:05:25|11234123412| NULL|missed
2010-09-16 00:09:03|14321234231| NULL|missed
2010-10-08 16:31:13|14234234253| NULL|missed
2010-10-05 17:34:28|15534535234| NULL|missed
2010-10-22 04:27:15|16127085031| NULL|missed
2010-10-22 23:46:55|12182308974| NULL|missed
我想是的NULL
持續時間的0
所取代,但IFNULL
似乎並沒有工作。
SELECT time,number,IFNULL(duration,0),calltype FROM calls LIMIT 10;
time | number|IFNULL(duration,0)|calltype
2011-02-21 19:06:19|11243243569| NULL|missed
2010-07-12 17:47:14|11234123445| NULL|missed
2010-07-01 20:55:14|11234123459| 52|placed
2010-07-24 22:43:53|12342345662| 363|received
2010-07-22 01:05:25|11234123412| NULL|missed
2010-09-16 00:09:03|14321234231| NULL|missed
2010-10-08 16:31:13|14234234253| NULL|missed
2010-10-05 17:34:28|15534535234| NULL|missed
2010-10-22 04:27:15|16127085031| NULL|missed
2010-10-22 23:46:55|12182308974| NULL|missed
事實上,這個問題,同時試圖使用COALESCE()
MAX()
總運營商,發現他們也返回空值出現。
這裏可能會發生什麼?我如何讓聚合忽略NULL和IFNULL
的工作?
更新
的結果列在此使用typeof
命令:
SELECT duration,typeof(duration) as typ FROM calls LIMIT 10;
duration|typ
NULL|text
NULL|text
52|integer
363|integer
NULL|text
NULL|text
NULL|text
NULL|text
NULL|text
NULL|text
我使用SQLite'3.8.2 2013年12月6日14點53分三十〇秒27392118af4c38c5203a04b8013e1afdb1cebd0d' – Richard 2014-12-07 23:00:29
升級到SQLite的'3.8.7.2情節中字20時57分56秒2ab564bf9655b7c7b97ab85cafc8a48329b27f93'沒有任何改變。 – Richard 2014-12-07 23:22:30
'SELECT DISTINCT typeof(duration)FROM calls'的輸出是什麼? – 2014-12-08 08:26:58