I have a blog with English and Swedish posts. I first wrote in English and then switched to Swedish.
My question is, If there is any way to only display post with a higher id?
Like:
select * FROM blog WHERE id is bigger than 100
Anyone get my drift and know if this is possible? :)
I don't want to delete the old posts, and I also don't want people to see them.
Thank you!
I think you mean
Select *
From blog
Where Id > 100
Order by ID DESC
See http://dev.mysql.com/doc/refman/5.0/en/sorting-rows.html for more information. If the ID is auto-incremented, this will bring the newest articles first, and not display the one with ID smaller than 100.
简单尝试一下
SELECT * FROM blog WHERE id > 100
Even though all the answers seem correct, it looks to me you actually want to have just the last 20 or so blog posts. In that case use LIMIT.
select * from blog order by id desc limit 20
如果您正在使用显示帖子的系统,则可能希望显示最新的几篇帖子,可以通过如下查询来完成:
SELECT * FROM `blog` WHERE ORDER BY `id` DESC LIMIT '100';
MySQL Select query have syntax for bigger then is > you can do
select * FROM blog WHERE id > 100
Hope above will help.
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.