我想从game_votes
where g_id
is equal to 计算所有行14
,它工作得几乎很好,但如果没有任何记录,g_id = 14
它仍然会显示1
在该cnt
字段中。
这是我的查询:
SELECT
SUM(vote) as vote,
COUNT(*) as cnt
FROM (`games`)
LEFT JOIN `game_votes`
ON
`game_votes`.`g_id` = `games`.`id`
WHERE `games`.`id` = '14'
怎么了?我错过了什么吗?