Untitled

From Putrid Hamerkop, 10 Months ago, written in Plain Text, viewed 123 times.
URL http://codebin.org/view/f3aceb66 Embed
Download Paste or View Raw
  1. WITH temp as
  2. (SELECT user_id,
  3.        COUNT(id)
  4. FROM stackoverflow.badges
  5. WHERE creation_date::date BETWEEN '2008-11-15' AND '2008-12-15'
  6. GROUP BY user_id
  7. ORDER BY COUNT(id) DESC
  8. LIMIT 10)
  9. SELECT temp.user_id,
  10.        temp.count,
  11.        RANK() OVER (ORDER BY temp.count)
  12. FROM temp  
  13. ORDER BY temp.count DESC, temp.user_id

Reply to "Untitled"

Here you can reply to the paste above