I have a simple articles table and want to select the lowest ID from the last 10 records. For example if there are 11 ids, the resulted id should be 2 and if there are 10 ids the resulted id should be 1 and so on.
I tried the following query on a table with 11 ids and it’s outputting 1 while it should output 2
SELECT MIN(id) FROM kisses ORDER BY id DESC LIMIT 10
Thanks
You can use a subquery and then use the MIN:
Here is the SQL Fiddle.
How about this, even easier:
More fiddle: http://sqlfiddle.com/#!2/4d835/8
Good luck.