开发者

Find value between two data range in MySql

开发者 https://www.devze.com 2023-01-07 08:29 出处:网络
I ha开发者_Go百科ve a table with three fields id,minvalue and maxvalue.These fields carries multiple values like...

I ha开发者_Go百科ve 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


This should work:

SELECT * FROM table WHERE 250 BETWEEN maxvalue AND minvalue


SELECT Id FROM table WHERE 250 BETWEEN MinValue AND MaxValue
0

精彩评论

暂无评论...
验证码 换一张
取 消