Hindari duplikat dalam satu ke banyak hubungan bergabung dalam SQL
SELECT columnlist,
rn = ROW_NUMBER() OVER (PARTITION BY sales.salesID ORDER BY payment.paymentID)
FROM sales JOIN payments ON sales.salesID=payments.salesID
Nice Nightingale