0

I have joined multiple table with below result.

 downtime |   month   | quarter  | sum_month | sum_quarter|   
    A     | JAN-2015  | Q1-2015  |    0.9    |   1.0      |  
    B     | JAN-2015  | Q1-2015  |    0.6    |   1.6      |  
    C     | JAN-2015  | Q1-2015  |    0.8    |   1.3      |  
    A     | FEB-2015  | Q1-2015  |    0.4    |   1.9      |  
    B     | FEB-2015  | Q1-2015  |    0.2    |   1.7      |  
    C     | FEB-2015  | Q1-2015  |    0.5    |   1.7      |

can anyone teach me how can i write a query to make the output as below?I'm using oracle 10g. I have search for the answer for quite sometimes and most query that i found is to split row with delimiter.

 downtime |   new_range | new_sum  | 
    A     |   JAN-2015  |   0.9    |         
    A     |   Q1-2015   |   1.0    |
    B     |   JAN-2015  |   0.6    |         
    B     |   Q1-2015   |   1.6    |
    C     |   JAN-2015  |   0.8    |         
    C     |   Q1-2015   |   1.3    |   
    A     |   FEB-2015  |   0.4    |        
    A     |   Q1-2015   |   1.9    |
    B     |   FEB-2015  |   0.2    |
    B     |   Q1-2015   |   1.7    |
    C     |   FEB-2015  |   0.5    | 
    C     |   Q1-2015   |   1.7    |   

Thanks.

elodea
  • 1
  • 1
  • What have you tried? We're not really here to teach you *how* to do something; we're here to help you when you have a problem when you *are* doing something. Have a look at what is [on topic](http://stackoverflow.com/help/on-topic) for stackoverflow. – Wai Ha Lee Aug 17 '15 at 07:44
  • possible duplicate of [Splitting string into multiple rows in Oracle](http://stackoverflow.com/questions/14328621/splitting-string-into-multiple-rows-in-oracle) – davegreen100 Aug 17 '15 at 08:49

1 Answers1

1
select downtime, month new_range, sum_month new_sum
from joined_table
union all
select downtime, quarter new_range, sum_quarter new_sum
from joined_table
Simimmo
  • 658
  • 1
  • 6
  • 15