我正在使用以下查询成功连接两个表。我想添加仅显示具有至少 2 条 SearchPrice >= 250000 记录的代理的条件...我尝试添加“HAVING COUNT( ) >= 2”但是当我添加这个时我只得到一个结果?我认为它可能将“HAVING COUNT( ) >= 2”应用于 ActiveAgent 表?
SELECT
r.EmailAddress AS ag_email,
e.ListingAgentFullName AS ag_name,
r.OfficeName AS ag_office_name
FROM RESI
e JOIN ActiveAgent r
ON e.ListingAgentNumber=r.MemberNumber
WHERE SearchPrice >= 250000;