本帖最后由 syg5434 于 2016-12-21 16:14 编辑 仅供参考,初学者,望多交流。 with s1 as (select servid, count(distinct t.type) as p_count from product t where t.type != 1 group by servid) select * from servst s where s.id in (select servid from s1 where s1.p_count between 1 and 3) and exists (select 1 from product p where s.id = p.servid and p.type = 1) |
学习一下wechat:lang_wechat_threadmessage |