Created
October 25, 2019 23:21
-
-
Save JKetelaar/223f834700163dbca84992c1b97691f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
t.Name AS TrackName, | |
(t.Milliseconds / 1000) AS Seconds | |
FROM | |
Track AS t | |
WHERE Milliseconds > ( | |
SELECT | |
Milliseconds | |
FROM | |
Invoice | |
NATURAL JOIN InvoiceLine | |
LEFT JOIN Track ON Track.TrackId = InvoiceLine.TrackId | |
GROUP BY | |
InvoiceLine.TrackId | |
ORDER BY | |
COUNT(*) | |
DESC, | |
Milliseconds DESC | |
LIMIT 0,1 | |
) ORDER BY Milliseconds; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment