我试图得到这个结果:
NULL 350
google 98
yahoo 5
bing 4
使用此查询:
SELECT engine, COUNT(engine) AS count
FROM visits
GROUP BY engine
ORDER BY count DESC
但它返回:
google 98
yahoo 5
bing 4
NULL 0
我该如何解决这个问题?
答案 0 :(得分:3)
改为使用COUNT(1)
:
SELECT engine, COUNT(1) AS count
FROM visits
GROUP BY engine
ORDER BY count DESC;