我有以下SQL语句。
SELECT COUNT(a.id), a.project_id, p.is_recommended
FROM assessments a
INNER JOIN projects p ON p.id=a.project_id
WHERE p.is_recommended = 1
GROUP BY project_id
HAVING COUNT(a.id) >= 3
我想计算一下结果的行数。
如果没有INNER JOIN
,我所要做的就是这样的事情...
SELECT * FROM
(SELECT COUNT(id), project_id
FROM assessments
GROUP BY project_id
HAVING COUNT(id) >= 3) assessments
但是,如果我的语句包含JOIN
,我该如何计算结果行数?我应该使用什么语法?
1条答案
按热度按时间8e2ybdfx1#