SELECT
(COUNT(v1.id) * 2) + (COUNT(v2.id) * 0.5) AS total,
COUNT(v1.id) AS votes,
COUNT(v2.id) AS visits
FROM
votes AS v1,
visits AS v2
;
实际上,此查询的投票和访问结果为 1710,但投票有 18 行,访问次数为 98 ......有人知道为什么吗?并且有什么解决办法吗?
正确的返回值是:
总计 85
18 票
98 次访问