我想要表中属于一个集合且特定的friend_id不存在的所有记录不超过两次
类似这样的事情
SELECT * FROM `friends` WHERE count(`friend_id`) < 2 and friend_id in (1,2,3,4)
最佳答案
你应该尝试:
SELECT * FROM friends where friend_id in (1,2,3,4) group by friend_id having count(friend_id) < 2
关于php - Mysql 查询计数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5910766/