...

View Full Version : Select data between values.



sorlaker
01-23-2012, 01:48 AM
i wanna select data between 2 prices. What mysql syntax code i'd use?

Old Pedant
01-23-2012, 04:01 AM
SELECT * FROM table WHERE price BETWEEN 13 AND 27

??? is that what you mean?

CAUTION: BETWEEN is *inclusive*. So both 13 and 27 would be found with that code. If you wanted greater than 13 and less than 27 (e.g., 13.01 to 26.99) the best thing to do would be to use two separate comparisons:


SELECT * FROM table WHERE price > 13 AND price < 27



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum