My SQL looks like this, it works fine:
select * from a where a.type = \'A\' and (select count(*) from b