Home > Database > Mysql Tutorial > How to query the latest records in mysql

How to query the latest records in mysql

王林
Release: 2020-10-19 10:57:09
Original
3979 people have browsed it

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;
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template