且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

获取最新时间戳MySQL的记录

更新时间:2023-01-29 21:10:37

您可以执行以下操作:

SELECT *
FROM table1
WHERE DATE(recordEntryDate) = (
   SELECT MAX(DATE(recordEntryDate))
   FROM table1
)

请注意,此查询将无法利用recordEntryDate上的索引.如果您有很多行,那么类似的查询对您来说可能会更快:

Note that this query won't be able to take advantage of an index on recordEntryDate. If you have a lot of rows this similar query might be faster for you:

SELECT *
FROM table1
WHERE recordEntryDate >= (
   SELECT DATE(MAX(recordEntryDate))
   FROM table1
)