i have a sql query:
select id, name from table order by name
result looks like this:
52 arnold
33 berta
34 chris
47 doris
52 emil
for a given id=47 how can i determine the position in the result set?
the result should be 4 because:
52 arnold
33 berta
34 chris
are before (47, doris) and id=41 is on the 4th position in the result set.
How to do this in SQL?
How in HQL?
In a pagination example, do i have to execute 2 statements or is there a solution where i can retrieve exactly that window which contains the row with id=47?
postgreSQL and java
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…