Anda perlu memfilter sebelum menggabungkan:
select s.buyer_id
from sales s join
product p
on s.product_id = p.product_id
where p.product_name = 'iPhone'
group by s.buyer_id;
Atau gunakan fungsi agregasi yang menghitung kecocokan:
having sum(p.product_name = 'iPhone') > 0