A small change GROUP BY PD.id FIRST then PD.barcode