Hi flakpit,

> MySql and msSql have seek commands to go to a( or return) a specific  
> row in a database base don the internal row number rather than an id  
> or other identifier.
>
> Is there a generic SELECT statement that can do this for sqlite or  
> indeed, any other sql variant?

SQL is (of course) a relational database language. As such, it deals  
with sets and subsets of data, which are inherently unordered, ie  
order is irrelevant.

Most of the time wen someone asks "how do I get row n of the data" it  
indicates that they're not making the best use of SQL.

So, first, my question is: Can you explain a bit ore of the context,  
preferably with some sample SQL code, in case others on this list can  
save you a lot of bother by optimizing your SQL and removing the need  
for row numbers at all.

Having said that, there are rare occasions when you do need the row  
number, usually when interfacing with some other programming  
environment (and as above this can usually be avoided by doing more in  
SQL first). To get the row number, you just:

select rowid from MyTable where Condition;

Tom
BareFeet

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

Reply via email to