Get maximum values of a COUNT in mysql

0

good afternoon

You will see, the query is this - > 4. Name of the song that has sold the most units.

The issue is that I'm trying to get the maximum values of a count in a subquery, so that

SELECT Track.Name, COUNT(invoiceline.Quantity) FROM track
INNER JOIN invoiceline ON track.TrackId = invoiceline.TrackId
GROUP BY invoiceline.TrackID
HAVING COUNT(invoiceline.Quantitly) > ALL 
(SELECT COUNT(Quantity) FROM invoiceline
GROUP BY TrackId)

I'm running out of ideas haha if you can help me, I'd appreciate it

    
asked by D3n3cry 03.02.2018 в 19:26
source

1 answer

0
SELECT Track.Name, MAX(invoiceline.Quantity) 
FROM track INNER JOIN invoiceline 
ON track.TrackId =invoiceline.TrackId
GROUP BY invoiceline.TrackID
    
answered by 03.02.2018 в 21:32