[摘要]1332.6,2900,1520.77搜索到这三个记录存在id为59,之后判断第二个搜索条件应为(即用对应id位置的数字对比):1690<20003502.1>20001520.77&l...
1332.6,2900,1520.77
搜索到这三个记录存在id为59,之后判断第二个搜索条件应为(即用对应id位置的数字对比):
1690<2000
3502.1>2000
1520.77<2000
drop table test;
create table test ( col1 varchar(100),col2 varchar(100));
insert test select
'26,59,6', '1502.5,1690,2276.77' union all select
'59,33,6', '3502.1,1020,2276.77' union all select
'22,8,59', '1332.6,2900,1520.77';
select col1,col2
from (select *,find_in_set('59',col1) as rn from test) k
where substring_index(concat(',',substring_index(col2,',',rn)),',',-1)
<'2000';+---------+---------------------+
关键词:MYSQL运用一个字符函数做数据筛选问题