Jump to content

[SOLVED] select * from db where id between 0 and no maximum < how can you specify no max?


dbx

Recommended Posts

my db holds the size of something in metres. I know the size won't realistically be over 10,000, but I want to include any possible number.

 

At the moment, I have "where id between 0 and 9999999999999"  ;D

 

Surely there is a better way to do this?

 

Thanks.

sorry, I should have explained it a little better.

 

the query is generated from form results, and sometimes it will be "between 0 and 10" etc

 

one of the options is "No Maximum" and its value is currently set to 999999999999

 

 

 

 

So when user chooses a maximum value do a query:

 

SELECT * FROM table WHERE ID > $min AND ID < $max;

 

And if he/she chooses 'no maximum' just omit 'AND ID < max' part

 

Alternatively, if you selected ID to be UNSIGNED INTEGER, you might use 4294967295 as a maximum value.

http://dev.mysql.com/doc/refman/5.1/en/numeric-types.html

Archived

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

×
×
  • Create New...

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.