请教一个多关键字查询问题例如有三条数据 : 1. 中国银行2. 中国中信银行3. 中信银行输入两个关键字 中国
请教一个多关键字查询问题
例如有三条数据 : 1. 中国银行
2. 中国中信银行
3. 中信银行
输入两个关键字 中国 中信 查询出来的结果是
1. 中国中信银行
2. 中国银行
3. 中信银行
用oracle怎么写
[解决办法]
select * from table_name where col_name like '%中国%'or col_name like '%中信%';
[解决办法]
- SQL code
--输入两个关键字做模糊查询是把--以下用到的table1为测试表--name为测试表中存储银行名称的列select distinct name from table1 where name like '%中国%' or '%中信%'
[解决办法]
- SQL code
--sql写错 补充select distinct name from table1 where name like '%中国%' or name like '%中信%'
[解决办法]
select * from (
select '中国中信' as a from dual
union all
select '中国银行' from dual
union all
select '中信银行' from dual
union all
select 'ICBC银行' from dual
union all
select '农业银行' from dual
) where regexp_like(a,'中国[[:alpha:]]|中信[[:alpha:]]')
A
------------
中国中信
中国银行
中信银行
