This should work in MySQL:
select * from A, B where A.id = B.a_id GROUP BY A.id HAVING COUNT(*) = 1;
For those of you who are not using MySQL, you will need to use aggregate functions (e.g. min () or max ()) for all columns (except A.id) so that your database engine does not complain.
source
share