SELECT a.*, b.*
FROM tab_a a
JOIN tab_b b ON a.a_id = b.a_id
WHERE NOT EXISTS (
SELECT 1
FROM tab_b
WHERE a.a_id = b.a_id AND b_col1 <> 1
);
SELECT a.*, b.*
FROM tab_a a
JOIN tab_b b ON a.a_id = b.a_id
WHERE NOT EXISTS (
SELECT 1
FROM tab_b
WHERE a.a_id = b.a_id AND b_col1 <> 1
);