OK, thanks for the info. I will just do what I said before, namely read the whole table (it won't be too big) and extract the required row from the returned array. The reason I wanted a row ID was that all the fields in the display grid can be edited, so by the time I come to process it, any of them might have changed from the original in the database so I can't use them in a WHERE clause. At least I know now.... Thanks again
P Kishor-3 wrote: > > On Thu, Feb 19, 2009 at 6:54 PM, His Nerdship > <[email protected]> wrote: >> >> Hi, >> I am converting a program from Paradox (stop laughing, please) to SQLite. >> Paradox has a useful feature where you can specify the actual index of a >> row >> in the table. This is handy when the table is displayed in a grid and >> you >> want the record corresponding to a row in that grid - you can just >> specify >> the index, say 28, of that grid row and it will get the record no 28 from >> the table. It spares the need for a SELECT statement, and is a lot more >> efficient. >> As a SQLite newbie, the only way I can see to do this is to read the >> whole >> table with sqlite3_get_table() and then get the required row from the >> returned array. This seems overkill when I just want a single record. > > There is the rowid, but I am not sure what you want to do... are you > expecting a database table to be a linear list of entries? Generally > one uses a spreadsheet for that kind of stuff. A SQL database doesn't > have an internal concept of order. You specify a criteria and the db > returns a SET of rows or records. You can constrain the SET by > specifying criteria (the WHERE clause), and you can impose an order on > the returned rows by specifying an ORDER clause. > > If you want just one specific row, just do a > > SELECT cols FROM table WHERE some_primary_key = ? > > If you don't want to specify and control your own primary key, you can > use the rowid which is something the db uses internally for its own > shenanigans. > > >> Is there a more compact way of doing this? >> Thanks in advance etc. >> Sholto > > > > -- > Puneet Kishor http://www.punkish.org/ > Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/ > Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/ > Sent from: Madison Wisconsin United States. > _______________________________________________ > sqlite-users mailing list > [email protected] > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > -- View this message in context: http://www.nabble.com/Any-concept-of-row-number-in-SQLite--tp22112862p22113562.html Sent from the SQLite mailing list archive at Nabble.com. _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

