[英]SELECT * FROM table WHERE id=(SELECT MAX(id) FROM TABLE)
I have news toggle box on my webpage, where I can click a view more link, and I toggles down and displays more news.我的网页上有新闻切换框,我可以在其中单击查看更多链接,然后向下切换并显示更多新闻。
How would I do if I want to display the latest news with one query, and with the other query display 3 other news that comes after the latest news.如果我想用一个查询显示最新消息,而用另一个查询显示最新消息之后的 3 个其他新闻,我该怎么办。
I hope you understand my question!我希望你明白我的问题!
I think that you want to use a limit statement我认为您想使用限制语句
to get the 1st record获得第一条记录
select * from table order by id desc limit 1
To get the 2-4th records获取第 2-4 条记录
select * from table order by id desc limit 3 offset 1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.