选择少于 10 个链接行的数据

Selecting data where there's less than 10 linked rows

我在 mySQL 数据库中有 2 个 table:

我想获取所有 ID 在帐户中出现 table <=10 次的代理。

SELECT count(ProxyId) from Account

不知道如何从这里继续并获得小于 10 的代理值出现。

试试这样的东西:

SELECT p.*
FROM Proxy AS p JOIN Account AS a ON p.ID = a.proxyID
GROUP BY p.ID
HAVING COUNT(*) <= 10
select a.Id from proxy a, account b
where a.ID = b.proxyId
group by a.ID
having count(*) <= 10