try
SELECT * FROM Mactor WHERE id=(Select max(id) from Mactor); //with this you get last id. SELECT * FROM Mactor WHERE id=(Select min(id) from Mactor); //with this you get first id.
Xavier
Miha Vrhovnik wrote:
Hi,
sqlite dll is 3.2.1
I have the folowing query:
SELECT * FROM Mactor WHERE id < 9223372036854775807 ORDER BY id DESC LIMIT 1;
where 9223372036854775807 is Maximum value of signed Int64.
Table is defined as:
CREATE TABLE Mactor (
id INTEGER PRIMARY KEY, name TEXT, birthName TEXT, birthday DATE, gender INTEGER, idCountry INTEGER, idProvince INTEGER, imdb TEXT, url TEXT, otherWork TEXT, biographiy TEXT, comment TEXT, pictures TEXT, custom TEXT);
There are two records in table one with id = 1 and other with id = 2
The query retuns an empty "dataset" BUT it works as soon as I remove ORDER BY clause.
P.S. If anybody has better Idea of how to get the last/first row (the one with highest/lowest ID) then comments are welcome.
Regards,
Miha
+*************************************************************+ It's time to get rid of your current e-mail client ... ... and start using si.Mail.
It's small & free. ( http://simail.sourceforge.net/ ) +*************************************************************+

