Good evening.
Due to many deletions, my database is non sequential anymore.
Is there any way to fetch the very first record in the database and find the
id number? Or for that matter, a function to select the last record?
I've tried the SELECT TOP 1 function butt that apparently isn't sqlite
On Dec 22, 2008, at 5:43 PM, flakpit wrote:
Good evening.
Due to many deletions, my database is non sequential anymore.
Is there any way to fetch the very first record in the database and
find the
id number? Or for that matter, a function to select the last record?
I've tried the
Dan Kennedy-4 wrote:
Is there any way to fetch the very first record in the database and
find the id number?
The 'first record' is a malleable concept. You can find the record with
the lowest rowid value with:
SELECT ... FROM table ORDER BY rowid LIMIT 1;
Thank you, that
On Dec 22, 2008, at 6:18 PM, flakpit wrote:
Dan Kennedy-4 wrote:
Is there any way to fetch the very first record in the database and
find the id number?
The 'first record' is a malleable concept. You can find the record
with
the lowest rowid value with:
SELECT ... FROM table
2. The above statement gets the lowest rowid but there appears to be
no
implicit statement to the direction of the ORDER BY clause. Can the
statement be reversed to get the highest rowid?
SELECT ... FROM table ORDER BY rowid DESC LIMIT 1;
Okay, I feel very stupid now, hadn't twigged. I