sql查询语句中怎么把一个通过sql查询语句查到的值进行模糊查询,再一条查询语句中完成

例如:select a from b where 。。 怎么再把查到的a进行模糊查询,在一条查询语句中实现,不行的话有其他解决办法没?

select b from B
where b like '%'+select a from A+'%'
查询语句放在加号和单引号里就可以了
温馨提示:内容为网友见解,仅供参考
第1个回答  2013-08-30
第一种:select a from b where…… and a like '%"+条件+"%'

第二种:select a from(select a from b where ……) where a like '%"+条件+"%'追问

‘%+条件+%这个条件就是查到的值a

追答

这个就是你所说的模糊条件 意思就是:查询所有a里面带有模糊条件的信息

追问

我先通过一个条件查询到值a,数据库中有值a,a1,a11,a111,a1111,那怎么通过查到的a值查到a1,a11,a111,a1111

追答

我的用户名看到了吧 加我 详细告诉你

本回答被提问者采纳
第2个回答  推荐于2018-03-26
select a from (select a from b t_b where t_b.name = 3) t_a where t_a.a like '%abc%'本回答被网友采纳
相似回答