在Mysql中获取两个点值之间的记录


Get records between two point values in Mysql

我有两列存储值(点值)。

如何在两列中的值之间选择给定数字的位置?

我希望你能通过这样做得到它:

让您的号码为$your_number,表名为your_table

所以你的问题是:

SELECT * FROM your_table WHERE $your_number BETWEEN col1 AND col2; 

或者如果确保col1<col2

SELECT * FROM your_table WHERE $your_number >= col1 AND $your_number <= col2;