|
|
|
Re: How to get this SQL output (2):- [message #597980 is a reply to message #597969] |
Wed, 09 October 2013 08:48 |
|
Michel Cadot
Messages: 68645 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
SQL> with
2 emp as (
3 select 101 code, 201 code1, 301 code2 from dual union all
4 select 102, 202, 302 from dual union all
5 select 103, 203, 303 from dual union all
6 select 104, 204, 304 from dual
7 ),
8 E_con_desc as (
9 select 101 e_code, 'A' e_decs from dual union all
10 select 102, 'B' e_decs from dual union all
11 select 103, 'C' e_decs from dual union all
12 select 104, 'D' e_decs from dual union all
13 select 201, 'E' e_decs from dual union all
14 select 202, 'F' e_decs from dual union all
15 select 203, 'G' e_decs from dual union all
16 select 204, 'H' e_decs from dual union all
17 select 301, 'I' e_decs from dual union all
18 select 302, 'J' e_decs from dual union all
19 select 303, 'K' e_decs from dual union all
20 select 304, 'L' e_decs from dual
21 )
22 select e.code code1, d1.e_decs desc1,
23 e.code1 code2, d2.e_decs desc2,
24 e.code2 code3, d3.e_decs desc3
25 from emp e, E_con_desc d1, E_con_desc d2, E_con_desc d3
26 where d1.e_code = e.code
27 and d2.e_code = e.code1
28 and d3.e_code = e.code2
29 /
CODE1 D CODE2 D CODE3 D
---------- - ---------- - ---------- -
101 A 201 E 301 I
102 B 202 F 302 J
103 C 203 G 303 K
104 D 204 H 304 L
|
|
|
|
Re: How to get this SQL output (2):- [message #597993 is a reply to message #597982] |
Wed, 09 October 2013 11:53 |
Lalit Kumar B
Messages: 3174 Registered: May 2013 Location: World Wide on the Web
|
Senior Member |
|
|
jgjeetu wrote on Wed, 09 October 2013 19:40thanks, able to understand this one but still facing trouble in previous topic(partition by).
That was SUM function used as an Analytic function with PARTITION BY clause in your previous topic. If you find difficulty in that thread, you should have mentioned it. You are lucky enough that people are pointing you to documentation links which are, strictly speaking, mandate for anybody to read and understand the basics.
Learn and share, basic principle to grow in any field.
Regards,
Lalit
[EDIT : Fixed typo errors]
[Updated on: Wed, 09 October 2013 11:56] Report message to a moderator
|
|
|
Re: How to get this SQL output (2):- [message #597999 is a reply to message #597993] |
Wed, 09 October 2013 12:58 |
pablolee
Messages: 2882 Registered: May 2007 Location: Scotland
|
Senior Member |
|
|
[quote title=Lalit Kumar B wrote on Wed, 09 October 2013 17:53]jgjeetu wrote on Wed, 09 October 2013 19:40
That was SUM function used as an Analytic function with PARTITION BY clause in your previous topic. If you find difficulty in that thread, you should have mentioned it. He did, several hours ago. Michel responded and OP responded back saying that he now has the appropriate document section to read. If you are going to pull someone up for their posts, take the time to read the posts involved and (in this instance) pay particular attention to the time stamps on each post.
|
|
|
Re: How to get this SQL output (2):- [message #598002 is a reply to message #597999] |
Wed, 09 October 2013 13:10 |
Lalit Kumar B
Messages: 3174 Registered: May 2013 Location: World Wide on the Web
|
Senior Member |
|
|
[quote title=pablolee wrote on Wed, 09 October 2013 23:28]Lalit Kumar B wrote on Wed, 09 October 2013 17:53jgjeetu wrote on Wed, 09 October 2013 19:40
That was SUM function used as an Analytic function with PARTITION BY clause in your previous topic. If you find difficulty in that thread, you should have mentioned it. He did, several hours ago. Michel responded and OP responded back saying that he now has the appropriate document section to read. If you are going to pull someone up for their posts, take the time to read the posts involved and (in this instance) pay particular attention to the time stamps on each post.
My mistake, I should have read other posts before responding here. Apologies.
|
|
|
Re: How to get this SQL output (2):- [message #598007 is a reply to message #598002] |
Wed, 09 October 2013 13:22 |
pablolee
Messages: 2882 Registered: May 2007 Location: Scotland
|
Senior Member |
|
|
Lalit Kumar B wrote on Wed, 09 October 2013 19:10
My mistake, I should have read other posts before responding here. Apologies.
Don't apologise to me, I'm not the one that you incorrectly pulled up.
|
|
|
|