so i wanted to get the expected result, while using a sub query but my answer isnt going to plan, below is the code i have and the result alongside my expected result
SELECT "Invoice"."BillingCountry", "Genre"."Name", COUNT("Track"."TrackId") FROM "Track"
INNER JOIN "Genre"
ON "Track"."GenreId" = "Genre"."GenreId"
INNER JOIN "InvoiceLine"
ON "Track"."TrackId" = "InvoiceLine"."TrackId"
INNER JOIN "Invoice"
ON "InvoiceLine"."InvoiceId" = "Invoice"."InvoiceId"
WHERE "Invoice"."BillingCountry" in ('USA', 'Canada', 'Brazil', 'france', 'Germany')
GROUP BY "Genre"."GenreId", "Invoice"."BillingCountry"
ORDER BY COUNT("Track"."TrackId") DESC
LIMIT 10
billingcountry | name | count
usa bat 50
canada bat 43
usa car 40
usa toy 39
germany bat 36
france bat 34
canada bike 20
usa fing 15
brazil bat 14
france shoe 10
expected result
country | item | count
usa bat 50
canada bat 43
germany bat 36
france bat 34
brazil bat 14
i know there are similar solutions here, but i cant just get them to work, will be grateful if someone can help