My SQL isn't the greatest, obviously, but what I'm trying to do is get the latest date in a database by finding the maximum year and month in an entry. Right now I have:
select max(Month), max(Year) from posts where postID = 25;
...but that results in the latest month and the latest year, though they're not part of the same entry. How can I make sure month and year are from one entry and not separate?
SELECT Month, Year FROM posts WHERE postID = 25 ORDER BY Year DESC, Month DESC LIMIT 1
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.