mardi 31 mars 2015

Get offset of a row after performing sort operation in sql

I am using SQLite database.


Suppose I have rows with IDs 1 to 50. Then I perform select and order by operation.


Say, the result is IDs : 6,3,5,2,9,12,1,34,45,15.


Now, I want to know the offset of a particular row with given ID in the above result.e.g. offset of ID 1 is 6.


Can I do this in a single query?


Aucun commentaire:

Enregistrer un commentaire