Brad got it:
sqlite> select * from t1 where rowid = (select max(rowid) from t1); 3|three Why is max(rowid) a "misuse". Seems perfectly logical to me. Not for an update but should work for select. Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate ________________________________ From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Brad Stiles [bradley.sti...@gmail.com] Sent: Monday, August 22, 2011 9:04 AM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] Last record in db What happens when you do: select * from t1 where rowid = (select max( rowid ) from t1); or select * from t1 where rowid in (select max( rowid ) from t1); On Mon, Aug 22, 2011 at 10:01 AM, Cousin Stanley <cousinstan...@gmail.com> wrote: > > Black, Michael (IS) wrote: > >> select * from table where rowid=max(rowid); > > $ sqlite3 m2d1.sql3 > -- Loading resources from /home/sk/.sqliterc > SQLite version 3.7.3 > Enter ".help" for instructions > Enter SQL statements terminated with a ";" > >> .tables > t1 t2 t3 > >> .schema t1 > CREATE TABLE t1(id INT,data TEXT); > >> select * from t1 ; > id data > ---------- ---------- > 1 one > 2 two > 3 tre > >> select * from t1 where rowid = max( rowid ) ; > Error: misuse of aggregate function max() > >> select max( rowid ) from t1 ; > max( rowid ) > ------------ > 3 > > > -- > Stanley C. Kitching > Human Being > Phoenix, Arizona > > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users