我正在使用以下查询从 MySQL 数据库中获取结果:
$query = $this->db->query("
SELECT * FROM results r
INNER JOIN categories c on r.id = c.result_id
INNER JOIN tags t on r.id = t.result_id
WHERE c.name in ('$purpose', '$prop_type', '$loan_type')
$tag_string
AND ( r.scope = 'all' OR r.scope = '$subdomain' )
GROUP BY r.id
HAVING COUNT(c.c_id) = 3
ORDER BY r.usefulness DESC
LIMIT 10 OFFSET $offset
");
返回的结果可能是 500+
如果没有限制,我如何计算此查询将返回的总行数,以便我可以将其显示给用户?