Jump to content


Photo

SELECT * WHERE row "is between 9 and 10"?


  • Please log in to reply
5 replies to this topic

#1 DaveLinger

DaveLinger
  • Members
  • PipPipPip
  • Advanced Member
  • 268 posts
  • LocationWV, USA

Posted 09 August 2006 - 12:52 AM

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!
http://www.DaveLinger.com
dave at linger dot com

#2 bltesar

bltesar
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts

Posted 09 August 2006 - 12:59 AM



SELECT * FROM games WHERE score>8 and score<11

#3 Corona4456

Corona4456
  • Members
  • PipPipPip
  • Advanced Member
  • 244 posts
  • LocationEl Paso, TX

Posted 09 August 2006 - 12:59 AM

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'
What is the CoronaMatrix?

#4 bltesar

bltesar
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts

Posted 09 August 2006 - 01:03 AM

Sorry, I didn't read the question as carefully as I should have.  Yes, WHERE >=9 AND <=10 is the correct clause.

#5 DaveLinger

DaveLinger
  • Members
  • PipPipPip
  • Advanced Member
  • 268 posts
  • LocationWV, USA

Posted 09 August 2006 - 01:09 AM

Thanks guys
http://www.DaveLinger.com
dave at linger dot com

#6 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 09 August 2006 - 01:24 AM

you could even use the thing designed for it!!!

SELECT * FROM `tablename` WHERE `score` BETWEEN 8 AND 11
follow me on twitter @PHPsycho




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users