title: How to get top N rows with some conditions
body: <p>I have a query something like this:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>But now, I want to see the <strong>top 10 product_id</strong> 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. </p>
  
  <p>How can I do this?</p>