Forum Moderators: coopster
Can anyone tell me how to use an 'OR' statement with MySQL to select a range of values:
SELECT * FROM table WHERE staffid >=26 OR <=65
This doesn't work but I thought it might. I want to select those in the table with staff if 26 to 65.
Many thanks
If you want both conditions to be true before returning any rows, use AND. (Or in this case, you could use BETWEEN to get the inclusive range).
[dev.mysql.com...]
SELECT * FROM table WHERE (staffid >=26) AND (staffid <=65)
SELECT * FROM table WHERE staffid between 26 and 65
should work tooo