Re: count of occurrences
От | Oliver Elphick |
---|---|
Тема | Re: count of occurrences |
Дата | |
Msg-id | 200109142028.f8EKSMIn005682@linda.lfix.co.uk обсуждение исходный текст |
Ответ на | count of occurences (adamcrume@hotmail.com (Adam)) |
Список | pgsql-general |
Adam wrote: >I help run a job database and have a table of search records. I want >a query that will return the top 10 jobs by search frequency. I'm >familiar with ORDER BY and LIMIT, so I basically need this: > >Given a table search_records: >job_num >------- >1 >2 >2 >3 >4 >4 >4 SELECT job_num, COUNT(*) FROM search_records GROUP BY job_num ORDER BY COUNT(*) DESC LIMIT 10; -- Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight http://www.lfix.co.uk/oliver PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47 GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C ======================================== "But without faith it is impossible to please him; for he that cometh to God must believe that he is, and that he is a rewarder of them that diligently seek him." Hebrews 11:6
В списке pgsql-general по дате отправления: