不行,not exists的前面要加字段名字,不然会出错。
select a.name,a.age,b.detail,b.code from zlb a,xxb b where a.serv_id=b.xh and b.code not exists(select b.code from zlb a,xxb b where a.serv_id=b.xh and b.code like '%12%)
select a.name,a.age,b.detail,b.code from zlb a,xxb b where a.serv_id=b.xh and b.code not exists(select b.code from zlb a,xxb b where a.serv_id=b.xh and b.code like '%12%)
解决方案 »
- oracle客户端导出服务器数据库的方法,寻解。
- 全文索引的几个问题
- oracle 安装问题
- 求一SQL,高手请进!
- sql查询问题。
- Oracle导入数据的问题
- windows2003server+oracle10g用http://server:5500/em进入后进行备份时,出现主机身份证明问题.
- 关于一个sql查询,如何写
- 关于ORCALE 9I的Listener问题!!!很急!!!!
- 高分求解,用C#生成COM+服务(数据库事务处理) 继承ServicedComponent
- 建好oracle数据库后如何建立用户,表?及在哪里建呀?
- 初学者提问:建好oracle数据库后如何建立用户,表?及在哪里建呀?
我知道用你那方法表达能达到那效果,关键是我用not exists难道就不能达到同样效果吗?
用:select a.name,a.age,b.detail from zlb a,xxb b where a.serv_id=b.xh and not exists(select b.name from zlb a,xxb b where a.serv_id=b.xh and b.code like '%12%)
和
select a.name,a.age,b.detail from zlb a,xxb b where a.serv_id=b.xh and b.code not like '%12%'得到的结果不一样,怪哦!
那not exists(select b.name from zlb a,xxb b where a.serv_id=b.xh and b.code like '%12%')
就为假,整个where就为假,查不出记录的
select a.name, a.age, b.detail
from zlb a, xxb b
where a.serv_id = b.xh
and b.code not like '%12%'