日期:2014-05-18  浏览次数:20593 次

带下滑线的字符串,如何模糊查询
如图:


我要查出 凡是包含‘轮’字的 所有数据



------解决方案--------------------
select * from tb where col like '%轮%'
------解决方案--------------------
SQL code

with tb as
(
    select '12065_2221_06轮_13_5' as v_params union all
    select '12065_2221_06轮_13_6' as v_params union all
    select '12065_2221_06轮_13_7' as v_params union all
    select '12065_2221_06轮_13_8' as v_params union all
    select '12065_2221_06轮_13_9' as v_params union all
    select '12065_2221_06轮_13_0' as v_params 
)
select * from tb
where v_params like '%轮%'

/*
v_params
--------------------
12065_2221_06轮_13_5
12065_2221_06轮_13_6
12065_2221_06轮_13_7
12065_2221_06轮_13_8
12065_2221_06轮_13_9
12065_2221_06轮_13_0

(6 row(s) affected)
*/
[img=http://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/3.gif][/img]