tags:

views:

26

answers:

2

I have a table with three fields id,minvalue and maxvalue.These fields carries multiple values like...

id Minvalue  maxvalue
 1  100        200
 2  201        300
 3  301        400

...and so on. If I supply 250 as input, how can I retrieve its corresponding id using mysql query?

Thanks

+1  A: 

This should work:

SELECT * FROM table WHERE 250 BETWEEN maxvalue AND minvalue
Pekka
Thank you.It is working.Your first answer also correct
Ajith
+1  A: 
SELECT Id FROM table WHERE 250 BETWEEN MinValue AND MaxValue
Chris Diver
Thank you for your response.
Ajith