SELECT t0.* FROM invoice as t0 INNER JOIN invoice_items as t1 ON t1.invoice_id = t0.idWHERE t0.id in (SELECT invoice_id FROM invoice_items WHERE product_id = 2 group by invoice_id) GROUP BY t0.idlimit 10;
It looks like you're new here. If you want to get involved, click one of these buttons!