Thank you Clemens and Michael!

In fact, it is for purposes of pagination.

For example, I have a web application that displays a list of customers. 
Each page of the list is 20 lines. It is sorted by city name.

If I need to display the customer N°45, I need to know its position in the list 
(sorted on the name of the city) to display the right page.

olivier

Le 4 juin 2013 à 14:41, Michael Black <mdblac...@yahoo.com> a écrit :

> 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

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

Reply via email to