forumnz Posted August 22, 2008 Share Posted August 22, 2008 I want to select * from a database where unit is equal to either A or B. How is this done? Would it be... WHERE unit BETWEEN A AND B...? Thanks Sam Link to comment https://forums.phpfreaks.com/topic/120942-select-2-possible-variables/ Share on other sites More sharing options...
pocobueno1388 Posted August 22, 2008 Share Posted August 22, 2008 SELECT * FROM table WHERE unit='A' OR unit='B' Link to comment https://forums.phpfreaks.com/topic/120942-select-2-possible-variables/#findComment-623429 Share on other sites More sharing options...
Fadion Posted August 23, 2008 Share Posted August 23, 2008 or you could do: SELECT * FROM table WHERE unit IN ('A', 'B') The "BETWEEN A AND B" isn't a correct syntax and obviously doesn't do what you want to achieve. It will find if the field is in the range of two integers. Example: SELECT * FROM table WHERE id BETWEEN 10 AND 100 //will find the values of id >= 10 AND <= 100 Link to comment https://forums.phpfreaks.com/topic/120942-select-2-possible-variables/#findComment-623455 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.