Skip to content
Advertisement

Sqlite get max id not working (?)

Im using this:

But my query is empty. I have also tried this (This one works):

But obviusly my query only contains the max_id key. What am I doing wrong with the first one?

Advertisement

Answer

You need to add another level of select for the MAX, like this:

A better approach would be to order by id in descending order, and limit the output to a single row:

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement