The problem is
a) you must have a limit clause for the register to even be tallied
b) the register is not part of the result set
c) it would be a very incompatible change to SQL syntax
d) there are other ways of achieving the same result, either in the caller or 
in a user written function

explain select * from test limit 3,4;
addr  opcode         p1    p2    p3    p4             p5  comment
----  -------------  ----  ----  ----  -------------  --  -------------
0     Trace          0     0     0                    00  NULL
1     Integer        4     1     0                    00  LIMIT counter
2     Integer        3     2     0                    00  NULL
3     MustBeInt      2     0     0                    00  OFFSET counter
4     IfPos          2     6     0                    00  NULL
5     Integer        0     2     0                    00  NULL
6     Add            1     2     3                    00  LIMIT+OFFSET
7     IfPos          1     9     0                    00  NULL
8     Integer        -1    3     0                    00  NULL
9     Goto           0     23    0                    00  NULL
10    OpenRead       0     2     1     3              00  test
11    Rewind         0     21    0                    00  NULL
12    AddImm         2     -1    0                    00  NULL
13    IfNeg          2     15    0                    00  NULL
14    Goto           0     20    0                    00  skip OFFSET records
15    Column         0     0     4                    00  test.a
16    Column         0     1     5                    00  test.b
17    Column         0     2     6                    00  test.c
18    ResultRow      4     3     0                    00  NULL
19    IfZero         1     21    -1                   00  NULL
20    Next           0     12    0                    01  NULL
21    Close          0     0     0                    00  NULL
22    Halt           0     0     0                    00  NULL
23    Transaction    1     0     0                    00  NULL
24    VerifyCookie   1     1     0                    00  NULL
25    TableLock      1     2     0     test           00  NULL
26    Goto           0     10    0                    00  NULL

-----Ursprüngliche Nachricht-----
Von: Gabriel Corneanu [mailto:gabrielcorne...@gmail.com]
Gesendet: Montag, 01. Juli 2013 14:58
An: sqlite-users@sqlite.org
Betreff: Re: [sqlite] Is there a way to return the row number? (NOT therowid)

Then this register value is exactly the needed result.
There is also the other syntax, "limit n, m"; you have to skip somehow "m" rows.

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


--------------------------------------------------------------------------
 Gunter Hick
Software Engineer
Scientific Games International GmbH
Klitschgasse 2 – 4, A - 1130 Vienna, Austria
FN 157284 a, HG Wien
Tel: +43 1 80100 0
E-Mail: h...@scigames.at

This e-mail is confidential and may well also be legally privileged. If you 
have received it in error, you are on notice as to its status and accordingly 
please notify us immediately by reply e-mail and then delete this message from 
your system. Please do not copy it or use it for any purposes, or disclose its 
contents to any person as to do so could be a breach of confidence. Thank you 
for your cooperation.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to