我試着去顯示0計數,如果計數爲0,例如MYSQL顯示結果即使計數爲0從一個表
CURENT結果:
Extension Calls
1234 1
1345 2
但我希望它顯示:
Extension Calls
1234 1
1245 0
1345 2
SELECT c.Extension,count(c.Extension),0 as Calls
from call c
where c.callType=3
and (c.StartTime between TIMESTAMP(CURDATE(),'06:30:00') and TIMESTAMP(CURDATE(),'07:00:00'))
group by c.Extension
是你有一個擴展表,從選擇,'留在擴展JOIN calls',你有你的結果。 – Wrikken 2013-03-04 23:48:36
擴展= 1245是否爲'Calls' NULL? – 2013-03-04 23:49:13
這個數據全部來自一個表 – user2133771 2013-03-04 23:50:46