Hi, I want to get serial numbers for selected record from 1 to number of rows. Your solution is right but in the situation when i want to sort by 'Party Name' column then the serial number depend on autoid field arrange also as sorted party name so i can't get it as serial records nos.
Please help me that what to do???? Robert Citek-2 wrote > How can I get a query to display sequential row number in a select > statement? > > I have a simple database similar to this: > > $ sqlite3 db .dump > BEGIN TRANSACTION; > CREATE TABLE foo (field); > INSERT INTO "foo" VALUES('a'); > INSERT INTO "foo" VALUES('b'); > INSERT INTO "foo" VALUES('c'); > COMMIT; > > $ sqlite3 db 'select * from foo ; ' > a > b > c > > I would like to do the equivalent of this in SQL: > > $ sqlite3 db 'select * from foo order by field desc ; ' | cat -n > 1 c > 2 b > 3 a > > I have looked into rowid but it keeps the actual row id from the table > and does not reorder the rowid based on the sort order. > > Pointers to references appreciated. > > Regards, > - Robert > _______________________________________________ > sqlite-users mailing list > sqlite-users@ > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users -- View this message in context: http://sqlite.1065341.n5.nabble.com/sequential-row-numbers-from-query-tp47370p68477.html Sent from the SQLite mailing list archive at Nabble.com. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users