DaveLinger Posted August 9, 2006 Share Posted August 9, 2006 I'm working on script which will check the score of each game review in a database, and display any games with a score between 9 and 10. (This may include "9", "9.2", "9.75", "10")How would I work that into an SQL query?Thanks! Link to comment https://forums.phpfreaks.com/topic/16976-select-where-row-is-between-9-and-10/ Share on other sites More sharing options...
bltesar Posted August 9, 2006 Share Posted August 9, 2006 SELECT * FROM games WHERE score>8 and score<11 Link to comment https://forums.phpfreaks.com/topic/16976-select-where-row-is-between-9-and-10/#findComment-71536 Share on other sites More sharing options...
Corona4456 Posted August 9, 2006 Share Posted August 9, 2006 Well assuming that 10 is the highest you can get ... you can do:SELECT * FROM `tablename` WHERE `score` >= '9'Or you you can do:SELECT * FROM `tablename` WHERE `score` >= '9' AND `score` <= '10' Link to comment https://forums.phpfreaks.com/topic/16976-select-where-row-is-between-9-and-10/#findComment-71538 Share on other sites More sharing options...
bltesar Posted August 9, 2006 Share Posted August 9, 2006 Sorry, I didn't read the question as carefully as I should have. Yes, WHERE >=9 AND <=10 is the correct clause. Link to comment https://forums.phpfreaks.com/topic/16976-select-where-row-is-between-9-and-10/#findComment-71540 Share on other sites More sharing options...
DaveLinger Posted August 9, 2006 Author Share Posted August 9, 2006 Thanks guys Link to comment https://forums.phpfreaks.com/topic/16976-select-where-row-is-between-9-and-10/#findComment-71542 Share on other sites More sharing options...
ToonMariner Posted August 9, 2006 Share Posted August 9, 2006 you could even use the thing designed for it!!!SELECT * FROM `tablename` WHERE `score` BETWEEN 8 AND 11 Link to comment https://forums.phpfreaks.com/topic/16976-select-where-row-is-between-9-and-10/#findComment-71547 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.