Re: [sqlite] Fetch first non-sequential record

2008-12-22 Thread flakpit
> 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 ORDER BY rowid DESC LIMIT 1; Okay, I feel very stupid now, hadn't twigged. I

Re: [sqlite] Fetch first non-sequential record

2008-12-22 Thread Dan
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: >> >>

Re: [sqlite] Fetch first non-sequential record

2008-12-22 Thread flakpit
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 ORDER BY rowid LIMIT 1; > > Thank y

Re: [sqlite] Fetch first non-sequential record

2008-12-22 Thread Dan
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 trie