Unix Technical Forum

Outer join with each record

This is a discussion on Outer join with each record within the Oracle Miscellaneous forums, part of the Oracle Database category; --> hi i want to show each outer join with each records. SQL> SELECT D.DEPTNO,E.ENAME 2 FROM EMP E,DEPT D ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database > Oracle Miscellaneous

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 11:16 AM
aishwan@gmail.com
 
Posts: n/a
Default Outer join with each record

hi

i want to show each outer join with each records.

SQL> SELECT D.DEPTNO,E.ENAME
2 FROM EMP E,DEPT D
3 WHERE D.DEPTNO=E.DEPTNO(+);

DEPTNO ENAME
--------- ----------
10 CLARK
10 KING
10 MILLER
20 SMITH
20 ADAMS
20 FORD
20 SCOTT
20 JONES
30 ALLEN
30 BLAKE
30 MARTIN
30 JAMES
30 TURNER
30 WARD
40
50

17 rows selected.

But i want

DEPTNO ENAME
--------- ----------
10 CLARK
20 CLARK
30 CLARK
40 CLARK
50 CLARK
10 KING
20 KING
30 KING
40 KING
50 KING
10 MILLER
20 MILLER
30 MILLER
40 MILLER
50 MILLER
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 11:16 AM
Robert Klemme
 
Posts: n/a
Default Re: Outer join with each record

On 01.09.2006 15:04, aishwan@gmail.com wrote:
> hi
>
> i want to show each outer join with each records.
>
> SQL> SELECT D.DEPTNO,E.ENAME
> 2 FROM EMP E,DEPT D
> 3 WHERE D.DEPTNO=E.DEPTNO(+);
>
> DEPTNO ENAME
> --------- ----------
> 10 CLARK
> 10 KING
> 10 MILLER
> 20 SMITH
> 20 ADAMS
> 20 FORD
> 20 SCOTT
> 20 JONES
> 30 ALLEN
> 30 BLAKE
> 30 MARTIN
> 30 JAMES
> 30 TURNER
> 30 WARD
> 40
> 50
>
> 17 rows selected.
>
> But i want
>
> DEPTNO ENAME
> --------- ----------
> 10 CLARK
> 20 CLARK
> 30 CLARK
> 40 CLARK
> 50 CLARK
> 10 KING
> 20 KING
> 30 KING
> 40 KING
> 50 KING
> 10 MILLER
> 20 MILLER
> 30 MILLER
> 40 MILLER
> 50 MILLER
> .
> .
> .
> so on for each employ record with outer join
>
> please help it is not homework.


Where is the problem? AFAIK you just need to add an ORDER clause.

robert
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-08-2008, 11:16 AM
Michel Cadot
 
Posts: n/a
Default Re: Outer join with each record


<aishwan@gmail.com> a écrit dans le message de news: 1157115890.201755.35940@h48g2000cwc.googlegroups.c om...
| hi
|
| i want to show each outer join with each records.
|
| SQL> SELECT D.DEPTNO,E.ENAME
| 2 FROM EMP E,DEPT D
| 3 WHERE D.DEPTNO=E.DEPTNO(+);
|
| DEPTNO ENAME
| --------- ----------
| 10 CLARK
| 10 KING
| 10 MILLER
| 20 SMITH
| 20 ADAMS
| 20 FORD
| 20 SCOTT
| 20 JONES
| 30 ALLEN
| 30 BLAKE
| 30 MARTIN
| 30 JAMES
| 30 TURNER
| 30 WARD
| 40
| 50
|
| 17 rows selected.
|
| But i want
|
| DEPTNO ENAME
| --------- ----------
| 10 CLARK
| 20 CLARK
| 30 CLARK
| 40 CLARK
| 50 CLARK
| 10 KING
| 20 KING
| 30 KING
| 40 KING
| 50 KING
| 10 MILLER
| 20 MILLER
| 30 MILLER
| 40 MILLER
| 50 MILLER
| .
| .
| .
| so on for each employ record with outer join
|
| please help it is not homework.
|
| aishwan
|

You said this is not a homework but it seems to be one as this is meaningless.
Search for cartesian product in your book.

Regards
Michel Cadot


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-08-2008, 11:16 AM
DA Morgan
 
Posts: n/a
Default Re: Outer join with each record

aishwan@gmail.com wrote:
> hi
>
> i want to show each outer join with each records.
>
> please help it is not homework.
>
> aishwan


Actually it is homework. The tables emp and dept are part of the scott
schema and your attempt to claim otherwise transparent. Please do not
ask us to do your school work for you.
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:25 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com