Using the Chinook Test Database I wrote this SQL statement to show all the tracks ordered by two specific customers:
SELECT inv.BillingCity,cus.LastName,tra.Name
FROM invoice AS inv
JOIN customer AS cus ON inv.CustomerId=cus.CustomerId
JOIN invoiceline inl ON inv.InvoiceId=inl.InvoiceId
JOIN track tra ON tra.TrackId=inl.TrackId
WHERE cus.LastName IN ('Schneider','Schröder')
ORDER BY inv.BillingCity,cus.LastName,tra.Name
I see that there is a track that was ordered twice by one customer:
How would I write an SQL statement to find doubles like this, i.e. "return all tracks ordered multiple times by one customer"?