Hello,
I hope this is the right place to get sqlite help.

I'm trying to figure out how to generate a relative row # in a sqlite query
result---->(in native SQL if possible---I'm not a C++ guy).

For example, if my query returns 80 rows, I'd like an extra column holding
sequential values 1 to 80 to help with paging

Suppose each page displays 10 records, to get page 3, in mySQL, I can use
the @a session variable with a materialized view like this:

Set @a = 0;
Select T1.rownumber, T1.Col2 from
        (
        Select @a:[EMAIL PROTECTED] as rownumber, Col1, Col2
        from Table where Col1 = 'abc' Order by Col1
        ) as T1
Where T1.rownumber between 21 and 30; -- gets only records for page 3

If this is not possible via the sql syntax, has someone written (or willing
to write) a "sequence" function that would do the same thing so we don't
have to do it ourselves in C??

Thanks in advance for any help,
Dewey

No virus found in this outgoing message.
Checked by AVG. 
Version: 7.5.519 / Virus Database: 269.22.10/1367 - Release Date: 4/9/2008
7:10 AM
 

No virus found in this outgoing message.
Checked by AVG. 
Version: 7.5.519 / Virus Database: 269.22.10/1367 - Release Date: 4/9/2008
7:10 AM
 

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

Reply via email to