开发者_运维技巧I would like a one line row on my site where that reads: Latest registered person: x
And the person x is the person with highest ID (which is auto_increment)..
How would that code look like?
SELECT *
FROM characters
LIMIT 1
ORDER BY id
You were very close:
SELECT *
FROM characters
ORDER BY id DESC
LIMIT 1
The syntax requires the ORDER BY to come before LIMIT, and you should have added a DESC to the ORDER BY, to get the last, not the furst user.
SELECT * FROM characters ORDER BY id DESC LIMIT 1 should do it, to get the highest id first.
加载中,请稍侯......
精彩评论