I would like to know, if is possible get the row position from ID in SQLite. I have a method that return an ID when I click on listView item, but there is a gap in the IDs when I delete an item from table and the method is not effective in this case. I found this code below that returns the position row in order, but I don't know how to implement it programmatically in my class and move the cursor and to get CTN.
SELECT _id, PRODUCER, (SELECT COUNT(*) FROM DATA B WHERE A._id >= B._id) AS CTN FROM DATA A
_id.........PRODUCER..............CTN
1............FIAT...........................1
2............FORD.........................2
3............RENAULT...................3
5............MWM..........................4
As I said, I can get the ID with a click on listView, my question is. if is possible any way to set this ID to return the position of the row. if possible show me with an example please.
thank you :)
Aucun commentaire:
Enregistrer un commentaire