select 字段a,
count(case when (条件) then 表1.字段b end) as c
from 表1 inner join 表2 on 表1.字段=表2.字段
可以用case加条件。
简单
select * from(select 字段a,count(表1.字段b) as c from 表1 inner join 表2 on 表1.字段=表2.字段)
as x where x.c 加条件
select 字段a,count(表1.字段b) as c from 表1 inner join 表2 on 表1.字段=表2.字段 WHERE ...
接着你那句:加 group by 字段a having c 条件(比如>2)