Home  >  Article  >  Database  >  How to query the latest records in mysql

How to query the latest records in mysql

王林
王林Original
2020-10-16 11:53:303911browse

Mysql method to query the latest records: 1. Log in to the database; 2. Select the database; 3. Execute the [select * from table name order by time field desc limit 0,1;] statement query.

How to query the latest records in mysql

Log in to the database

(Recommended tutorial: mysql video tutorial)

How to query the latest records in mysql

Select database

How to query the latest records in mysql

Use order by time desc to query data in descending order of time and add limit 0,1 conditions to select a piece of data starting from the first piece of data That is, the latest record in the mysql database; the complete statement is as follows:

select * from 表名 order by 时间字段 desc limit 0,1;

Related recommendations: mysql tutorial

The above is the detailed content of How to query the latest records in mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn