I have a query something like this:
SELECT product_id,
site,
category_id,
session_time,
sum(cast(coalesce("#clicks",
0) AS bigint)) AS clicks
FROM df
WHERE site IN ('com', 'co')
AND session_time = DATE('2020-02-27')
GROUP BY product_id, site, session_time, category_id
ORDER BY clicks desc
LIMIT 10
But now, I want to see the top 10 product_id for each site and category_id based on the clicks. When I write the LIMIT function, it only shows the top 10 products but it does not group it by category_id and shop_id.
How can I do this?