我正在尝试找到一种解决方案,使不带“限制”子句的查询的总行数和带限制子句的查询记录受到影响......如何在没有 2 个查询(计数(*)和主查询?
谢谢
编辑:这是我的查询:
$result = mysqli_query($link,"SELECT DISTINCT p.*
FROM posts p
JOIN abos a
ON p.userid = a.blogid OR p.userid = 11
LEFT JOIN posts_denied r
ON r.post_id = p.id AND r.userid = 11
WHERE (a.userid = 11 OR p.userid = 11)
AND r.post_id IS NULL
ORDER BY p.id DESC
LIMIT 5");