[英]Select rows between, where column is of type varchar
I want to do a mysql query to get all rows where a column is between two values. 我想做一个mysql查询,以获取列在两个值之间的所有行。 The column is of type varchar.
该列的类型为varchar。 For example:
例如:
SELECT id FROM table WHERE column BETWEEN '6103' AND '6108'
The column is from type varchar and contains values like: '6103123', '6103123/17', '6104123', '6104124' ... 该列来自varchar类型,包含类似'6103123','6103123/17','6104123','6104124'的值...
尝试这个 :
SELECT id FROM table WHERE SUBSTRING(column,1,4) BETWEEN '6103' AND '6108'
Try this one: 试试这个:
SELECT id FROM table WHERE column BETWEEN '6103' AND '6108'
because '6103' <= '6103123' <= '6108'. 因为'6103'<='6103123'<='6108'。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.