简体   繁体   中英

i want to fetch all record from my database table without recent added record

i want to fetch all record from MySQL database table using PHP without last added record

I have 4 Columns in the Table, ID(auto) & title and message.

You can use this, if as you say, ID is auto_increment

$sql = "SELECT * FROM table WHERE ID != (SELECT MAX(ID) FROM TABLE) ORDER BY ID";

This is selecting all the records from your table, ordered by id, where the id is not the biggest one.

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.

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