Aravinda babu wrote: > Is there any easy way to get the last row in the table ?
What do you mean by "last row"? Do you mean you want to get back the row that was most recently inserted? If so, then the table needs to have a column containing info about insertion order of rows, such as a serial number that is guaranteed to always increase and not repeat, or such as a timestamp. If you had a column like that, say name it 'myorder', then you could use a query like this to get the last row: select * from mytable where myorder IN (select max(myorder) from mytable) If you mean get the row that would sort last in a query, then you have something like this at the end of the query, after the "ORDER BY": LIMIT 1 OFFSET (select count(*) from mytable) - 1 Or better yet, reverse your ORDER BY condition / make it DESC, in which case you can then just return the *first* row: LIMIT 1 Note that rows in tables are not ordered (a table is a set of rows), so there is no concept of newly inserted ones going at the end. -- Darren Duncan _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users