sql - Sqlite get max id not working (?) -


im using this:

select *  id=max(id)  history; 

but query empty. have tried (this 1 works):

select max(id) max_id  history; 

but obviusly query contains max_id key. doing wrong first one?

you need add level of select max, this:

select *  id=(select max(id) history) history; 

a better approach order id in descending order, , limit output single row:

select * history order id desc limit 1 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -