|
蓝森林 http://www.lslnet.com 2006年8月26日 15:18
左连接右连接问题???????????????????
请问各位,如何写左连接右连接,我写过右连接 ,但写左连接的时候不好用,
请问是为什么????难道跟8I和9I有关吗????? |
左连接右连接问题???????????????????
左连接和右连接实现的是不同的逻辑。
不好用指什么? |
左连接右连接问题???????????????????
我说的不好用就是我用的时候不能用,望指教 |
左连接右连接问题???????????????????
你这么问谁能帮你?
[oracle@jumper oracle]$ sqlplus scott/tiger
SQL*Plus: Release 9.2.0.4.0 - Production on Sat Oct 23 23:08:39 2004
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
SQL>; select * from emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10
14 rows selected.
SQL>; select * from dept;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
SQL>; select a.ename,b.dname from emp a ,dept b where a.deptno(+) = b.deptno;
ENAME DNAME
---------- --------------
CLARK ACCOUNTING
KING ACCOUNTING
MILLER ACCOUNTING
SMITH RESEARCH
ADAMS RESEARCH
FORD RESEARCH
SCOTT RESEARCH
JONES RESEARCH
ALLEN SALES
BLAKE SALES
MARTIN SALES
ENAME DNAME
---------- --------------
JAMES SALES
TURNER SALES
WARD SALES
OPERATIONS
15 rows selected.
SQL>; select a.ename,b.dname from emp a ,dept b where a.deptno = b.deptno(+);
ENAME DNAME
---------- --------------
SMITH RESEARCH
ALLEN SALES
WARD SALES
JONES RESEARCH
MARTIN SALES
BLAKE SALES
CLARK ACCOUNTING
SCOTT RESEARCH
KING ACCOUNTING
TURNER SALES
ADAMS RESEARCH
ENAME DNAME
---------- --------------
JAMES SALES
FORD RESEARCH
MILLER ACCOUNTING
14 rows selected. |
左连接右连接问题???????????????????
谢谢老兄提示,我也看明白了,但为什么我用
select a.ename,b.dname from emp a ,dept b where a.deptno(+) = b.deptno
这样的连接却出错呢???? |
左连接右连接问题???????????????????
报的什么错呀 |
| |