Re: [SQL] Determining Rank

2005-02-04 Thread PFC
Michael, That's an excellent solution, but on my table, the explain plan sucks and the query time is over 3 minutes when implemented. Is there a simple way to get a row_num without using a temporary sequence? Thanks for your help. -Don Make your query a set returning function which iterates over

Re: [SQL] Determining Rank

2005-02-04 Thread Don Drake
Michael, That's an excellent solution, but on my table, the explain plan sucks and the query time is over 3 minutes when implemented. Is there a simple way to get a row_num without using a temporary sequence? Thanks for your help. -Don On Fri, 4 Feb 2005 14:02:20 +0900, Michael Glaesemann <[E

Re: [SQL] Determining Rank

2005-02-03 Thread Michael Glaesemann
On Feb 4, 2005, at 12:06, Don Drake wrote: I have a query that shows the top N count(*)'s. So it's basically: select some_val, count(*) from big_table group by some_val order by count(*) limit 50 Now, I would like to have the rank included in the result set. The first row would be 1, followed by 2

Re: [SQL] Determining Rank

2005-02-03 Thread Michael Fuhr
On Thu, Feb 03, 2005 at 09:06:36PM -0600, Don Drake wrote: > select some_val, count(*) > from big_table > group by some_val > order by count(*) > limit 50 > > Now, I would like to have the rank included in the result set. The > first row would be 1, followed by 2, etc. all the way to 50. Maybe

[SQL] Determining Rank

2005-02-03 Thread Don Drake
I have a query that shows the top N count(*)'s. So it's basically: select some_val, count(*) from big_table group by some_val order by count(*) limit 50 Now, I would like to have the rank included in the result set. The first row would be 1, followed by 2, etc. all the way to 50. I can do thi