我试图从具有 20 条或更多消息的各个 ip 中选择所有消息,但我在选择它时遇到了问题。这是我的查询:
SELECT messages
FROM currentChat
HAVING count(id) >= 20
GROUP by ip
最佳答案
您需要加入
或类似的东西:
SELECT cc.*
FROM currentChat cc JOIN
(SELECT ip, COUNT(*) as cnt
FROM currentChat
GROUP by ip
HAVING cnt >= 20
) i20
ON cc.ip = i20.ip;
关于php - 从具有 20 条或更多消息的各个 ip 选择所有消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37847699/