Jump to content

Archived

This topic is now archived and is closed to further replies.

Canman2005

SQL ID Range

Recommended Posts

Hi all

Can you do a ID range on a sql statement, so it shows ID numbers 1 -200 for example?

I use the following code for a simple statement

[code]SELECT * FROM users[/code]

Can a WHERE ID = 1 -200 be used? Or am I writting the wrong code?

Thanks in advance

Ed

Share this post


Link to post
Share on other sites
Is it just the first 200 rows you want? If so you can use this.
[code]SELECT id FROM users ORDER BY id LIMIT 200;[/code]

Or if you do actually only want the rows with id between 1 and 200, then use this:
[code]SELECT id FROM users WHERE id BETWEEN 1 AND 200;[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.