안녕하세요
데이타는 다음과 같습니다.
SELECT '2014-11-17 07' hour ,'I003' c1 ,'1' c2,'3000' v1 ,'107000' v2 from dual union all
SELECT '2014-11-17 07','I003','1','25000','107000' from dual union all
SELECT '2014-11-17 07','I003','2','107000','107000' from dual union all
SELECT '2014-11-17 07','I003','7','463000','107000' from dual union all
SELECT '2014-11-17 08','I003','7','1445000','137000' from dual union all
SELECT '2014-11-17 08','I003','3','137000','137000' from dual union all
SELECT '2014-11-17 08','I003','1','8000','137000' from dual union all
SELECT '2014-11-17 08','I003','1','83000','137000' from dual union all
SELECT '2014-12-06 07','C152','1','2954000','284000' from dual union all
SELECT '2014-12-06 07','C152','1','95000','284000' from dual union all
SELECT '2014-12-06 07','C152','5','120000','284000' from dual union all
SELECT '2014-12-06 07','C152','1','2000','284000' from dual union all
SELECT '2014-12-06 07','C152','4','13000','284000' from dual union all
SELECT '2014-12-06 07','C152','1','30000','284000' from dual union all
SELECT '2014-12-06 07','C152','1','21000','284000' from dual union all
SELECT '2014-12-06 07','C152','2','151000','284000' from dual union all
SELECT '2014-12-06 07','C152','7','212000','284000' from dual
옆의 값을 가지고 각 값이 끝나는 지점에 마지막 로우의 옆값을 가지고 중간에 다음과 같이 값을 끼워넣기 문의 드립니다.
결과값이 잘못 되엇는데 답변해주신 성준님 대단하시네요 감사합니다.
제가 원하는건 우측의 값을 맨 마지막에 추가하는것인데
실제로는 컬럼이 엄청 많습니다. 그래서 가급적 group by 를 않쓰고 할수 있는 방법이 있을까 해서
질문을 드립니다.
2014-11-17 07 |
I003 |
1 |
3000 |
2014-11-17 07 |
I003 |
1 |
25000 |
2014-11-17 07 |
I003 |
2 |
107000 |
2014-11-17 07 |
I003 |
7 |
463000 |
2014-11-17 07 |
I003 |
7 |
107000 |
2014-11-17 08 |
I003 |
7 |
1445000 |
2014-11-17 08 |
I003 |
3 |
137000 |
2014-11-17 08 |
I003 |
1 |
8000 |
2014-11-17 08 |
I003 |
1 |
83000 |
2014-11-17 08 |
I003 |
1 |
137000 |
2014-12-06 07 |
C152 |
1 |
2954000 |
2014-12-06 07 |
C152 |
1 |
95000 |
2014-12-06 07 |
C152 |
5 |
120000 |
2014-12-06 07 |
C152 |
1 |
2000 |
2014-12-06 07 |
C152 |
4 |
13000 |
2014-12-06 07 |
C152 |
1 |
30000 |
2014-12-06 07 |
C152 |
1 |
21000 |
2014-12-06 07 |
C152 |
2 |
151000 |
2014-12-06 07 |
C152 |
7 |
212000 |
2014-12-06 07 |
C152 |
7 |
284000 |
|