Hi,

select count(*) from foo where rowid < X

Martin

Am 08.06.2011 16:18, schrieb Marco Bambini:
> I have a table foo with N rows and I want to know the offset of the row with 
> rowid X inside that table.
> What query/strategy should I perform?
>
> I assume that a brute force algorithm should be
> 1. SELECT * FROM foo ORDER BY rowid;
> 2. loop inside the recordset until X is found incrementing a counter by 1
> but I am quite sure that should be a more elegant way.
>
> Thanks a lot.
> --
> Marco Bambini
> http://www.sqlabs.com
>
>
>
>
>
>
>
>
> _______________________________________________
> 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