• Post Reply Bookmark Topic Watch Topic
  • New Topic

Return row # for ranking in Hibernate SQL

 
Joshua Elkino
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to return a row #?
I'm trying to rank something based on a sorted column, but i'm not sure how to get the row number w/out looping through the entire resultset with a counter and matching my expression.

I'm using hibernate, but i dont even know if there is a simple method in SQL.
 
Edvins Reisons
Ranch Hand
Posts: 364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that this is database-specific, like rownum in Oracle.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!