我正在尝试查找以下查询返回的行数:
SELECT Count(id) AS fcount,
user_id
FROM customer_followups
WHERE id > 0
AND Date(followup_date) >= Str_to_date("24-09-2012", "%d-%m-%y")
AND Date(followup_date) <= Str_to_date("24-09-2012", "%d-%m-%y")
GROUP BY user_id
ORDER BY user_id
它返回我 5 行。
但是,如果我在没有计数功能的情况下触发查询,我只会得到一条记录。见下文:
SELECT id,
user_id
FROM customer_followups
WHERE id > 0
AND Date(followup_date) >= Str_to_date("24-09-2012", "%d-%m-%y")
AND Date(followup_date) <= Str_to_date("24-09-2012", "%d-%m-%y")
GROUP BY user_id
ORDER BY user_id
可能是什么原因?理想情况下,计数应该返回 1 ??