1、 select mothername from a where id in(select id from(select id,count(*) count from b group by id) where count=2) 2、 select mothername from a where id in(select id from(select id,count(*) count from b group by id having childsex=0) where count=2)
第二个改一下: select mothername from a where id in(select id from(select id,count(*) count from b where childsex=0 group by id ) where count=2)
1、 select mothername from a ,(select id from(select id,count(*) count from b group by id) where count=2) c where a.id=c.id 2、 select mothername from a ,(select id from(select id,count(*) count from b group by id having childsex=0 and count=2) c where a.id=c.id
select mothername from a where id in(select id from(select id,count(*) count from b group by id) where count=2)
2、
select mothername from a where id in(select id from(select id,count(*) count from b group by id having childsex=0) where count=2)
select mothername from a where id in(select id from(select id,count(*) count from b where childsex=0 group by id ) where count=2)
select mothername from a ,(select id from(select id,count(*) count from b group by id) where count=2) c where a.id=c.id 2、
select mothername from a ,(select id from(select id,count(*) count from b group by id having childsex=0 and count=2) c where a.id=c.id