[英]Get records between two point values in Mysql
I have two columns that store values(point values).我有两列存储值(点值)。
How do I select where my given number is between the values in the two columns ?如何选择给定数字在两列值之间的位置?
I hope you can get it by doing this:我希望你能通过这样做得到它:
Lets your number is $your_number and table name is your_table让你的号码是 $your_number 表名是 your_table
So your query would be:所以你的查询是:
SELECT * FROM your_table WHERE $your_number BETWEEN col1 AND col2;
Or if it is ensured that col1 < col2或者如果确保 col1 < col2
SELECT * FROM your_table WHERE $your_number >= col1 AND $your_number <= col2;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.