Or perhaps this is better since it is your example:

sqlite> create table people(id,name);
sqlite> insert into people values(5,'Chris');
sqlite> insert into people values(12,'Arthur');
sqlite> insert into people values(23,'Bill');
sqlite> insert into people values(34,'Ron');
sqlite> insert into people values(43,'William');
sqlite> select rowid,* from people;
1|5|Chris
2|12|Arthur
3|23|Bill
4|34|Ron
5|43|William
sqlite> create table mylist as select id,name from people order by name;
sqlite> select rowid,* from mylist;
1|12|Arthur
2|23|Bill
3|5|Chris
4|34|Ron
5|43|William


-----Original Message-----
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Paxdo
Sent: Tuesday, June 04, 2013 4:50 AM
To: General Discussion of SQLite Database
Subject: [sqlite] Row_number?


Hello,

I have a problem and I do not find the solution with Sqlite. I need an
equivalent to ROW_NUMBER.

Here's the problem:

SELECT id, name FROM people ORDER BY name

On this, I would like to know the line number of the ID 34, how?

example:

SELECT id, name FROM people ORDER BY name
Result:

12 Arthur
23 Bill
5 Chris
34 Ron
43 William

The line number of the ID34 is 4. 
But how to know with sqlite?

Thank you very much!

Olivier
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to