On Sat, Oct 02, 2010 at 09:27:39AM -0700, shareproduct wrote:

what's the fastest way to get rank of of row from a table with 20
000+  rows?
can someone please post a sql script

I haven't tried to see how efficient this will be, and it won't
distinguish among elements where the sort field has the same value.

SELECT COUNT(*) FROM tablename where num >= (SELECT num FROM tablename where NAME = 'joe')

If the query is made a lot, it might be better to make a temporary
table, sorted by the key with an auto-incrementing field, or something
like that.

David

--
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to