user3691340
user3691340

Reputation: 1

PHP MySQL select * WHERE id = > 100

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!

Upvotes: 0

Views: 423

Answers (5)

Manish Bagra
Manish Bagra

Reputation: 1

MySQL Select query have syntax for bigger then is > you can do

select * FROM blog WHERE id > 100

Hope above will help.

Upvotes: 0

Azrael
Azrael

Reputation: 1094

If you are working with a system for showing posts, you might rather want to show the latest few posts, which can be done with a query like this:

SELECT * FROM `blog` WHERE ORDER BY `id` DESC LIMIT '100';

Upvotes: 0

winkbrace
winkbrace

Reputation: 2711

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

Upvotes: 0

sameer kumar
sameer kumar

Reputation: 149

Simple Try this

SELECT * FROM blog WHERE id > 100

Upvotes: 0

Unix von Bash
Unix von Bash

Reputation: 730

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.

Upvotes: 2

Related Questions