解决方案 »
- linux 5.3 X64安装oracle10g停在 oracle database configuration assistant不动了
- XP SP2安装oracle8 professional版,出现stopsrvc.vrf(78):Type mismatch 错误,急
- 触发器中的sql语句错误,大家请帮忙看一下
- 数据库启动问题
- 有了客户的license号,怎么才能在metalink.oracle.com注册成功呢?让输入CSI号,是否就是许可号呢?
- 问 windows 2003 server 下安装oracle 92 ?
- 安装Oracle9i时,提示缺少一个文件。
- 哪里能下载到ORACLE9.2.0.4 for linux的patch文件?急啊!!!
- 急:OEM怎么启动?oracle8i(R8.1.5) for Linux
- PL/SQL使用substr方法查询出现乱码,与sqlplus结果不一致
- 关于oracle自动复制
- sql语句简化优化
FROM TBMAIN, TBKH
WHERE TBMAIN.XH = TBKH.XH(+)
create table tbMain
(xm varchar(10),xh varchar(10),gzdw varchar(10))insert into tbMain
select '张三','A001','市招商局' union all
select '李四','A002','市招商局' union all
select '王五','B001','市教育局' union all
select '张兵','B002','市教育局'create table tbKh
(xh varchar(10),khnd varchar(10),khdc varchar(10))insert into tbKh
select 'A001','2012','优秀' union all
select 'A002','2012','合格' union all
select 'A001','2013','优秀' union all
select 'B001','2012','优秀' union all
select 'B002','2012','合格' union all
select 'B001','2013','优秀' union all
select 'B002','2013','合格'
select a.xm,a.xh,a.gzdw,b.khnd,b.khdc
from tbMain a
left join tbKh b on a.xh=b.xh and khnd='2013'
where a.gzdw='市招商局'/*
xm xh gzdw khnd khdc
---------- ---------- ---------- ---------- ----------
张三 A001 市招商局 2013 优秀
李四 A002 市招商局 NULL NULL(2 row(s) affected)
*/