1-yechim:
SELECT distinct email,firstname,lastname,e.name
FROM Customer a,Invoice b,InvoiceLine c,Track d,Genre e
WHERE a.Customerid=b.Customerid AND b.Invoiceid=c.Invoiceid
AND c.Trackid=d.Trackid AND d.Genreid=e.Genreid AND e.name = 'Rock' ORDER BY email;
2-yechim:
SELECT Customer.Email, Customer.FirstName, Customer.LastName, Genre.Name
FROM Customer
INNER JOIN Invoice ON Customer.CustomerId=Invoice.CustomerId
INNER JOIN InvoiceLine ON Invoice.InvoiceId=InvoiceLine.InvoiceId
INNER JOIN Track ON InvoiceLine.TrackId=Track.TrackId
INNER JOIN Genre ON Genre.GenreId=Track.GenreId
WHERE Genre.Name="Rock"
GROUP BY Customer.CustomerId
ORDER BY Customer.Email
Do'stlaringiz bilan baham: |