How to display one column values to multiple column values?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kishore Roul
    New Member
    • Jan 2011
    • 6

    How to display one column values to multiple column values?

    input is like
    Type,Financial_ yr,Month,Amount
    T1 ,2010 ,April,1000
    T1 ,2010 ,May ,2000
    T1 ,2010 ,June ,3000
    T2 ,2011 ,May ,1500
    T2 ,2011 ,July ,3500
    T2 ,2011 ,Aug ,4000
    My output wiil be like
    Type,Financial_ yr,M1 ,M2 ,M3 ,Total_amount
    T1 ,2010 ,1000 ,2000,3000,6000
    T2 ,2011 ,1500 ,3500,4000,9000
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    You could use a pivot if oracle supports that. Otherwise you'll have to use a bunch of case statements.

    Comment

    • debasisdas
      Recognized Expert Expert
      • Dec 2006
      • 8119

      #3
      You need to read the following article for details.

      article.

      Comment

      • amitpatel66
        Recognized Expert Top Contributor
        • Mar 2007
        • 2358

        #4
        Thats called pivot. Which version of database are you using?

        Comment

        Working...