简体   繁体   English

如何查找特定日期的MYSQL表输入项的第一个和最后一个ID?

[英]How to find the first and last ID of MYSQL Table Enteries for a specific date?

I want to get the range of entries by their IDs created in a MYSQL table on a specific date in a PHP file. 我想通过特定日期在PHP文件中的MYSQL表中创建的ID来获取条目的范围。 How can this be achieved? 如何做到这一点? If required, assume there is a column in the database that lists the date when an entry is created. 如果需要,假定数据库中有一列列出创建条目的日期。

是的,您可以执行以下查询:

SELECT MIN(id), MAX(id) FROM tablex WHERE entrydate = 'YYYY-MM-DD'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM