+ -
当前位置:首页 → 问答吧 → DB2问题:求教sql语句like的用法?

DB2问题:求教sql语句like的用法?

时间:2011-11-18

来源:互联网

请教各位以下语句怎么不对?
select * from A where A.code like (select code from B where pcode='111')||'%'

要是修改应该怎么修改呢?

作者: shiyoumaomao   发布时间: 2011-11-18

select * from A where A.code like (select code from B where pcode='111')||'%
红字部分查询的code结果不止一个吧

作者: xpingping   发布时间: 2011-11-18

SQL code
select *
  from A
 where A.code in (select code from B where pcode = '111') 

作者: lisong770818   发布时间: 2011-11-18

原因是子查询的返回结果是多个。
SQL code

select * from A where A.code IN (select code from B where pcode LIKE '111%';

作者: LuiseRADL   发布时间: 2011-11-18

热门下载

更多