sqlite to print indexes of results
If you ever need to print the index of a row in your sqlite result set, here's what we've used:
SELECT (SELECT COUNT(0) FROM table1 S1 WHERE S1.id <= S.id) AS number, id FROM table1 S
and you'll get something like:
-------------
| number | id |
-------------
| 1 | A8U4-...
| 2 | AI84-...
| 3 | A9A4-...
| 4 | A044-...
Written by Miles Matthias
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Sqlite
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#