Re: pivoting data? - Mailing list pgsql-general

From Sim Zacks
Subject Re: pivoting data?
Date
Msg-id 4E68C65E.1030805@compulab.co.il
Whole thread Raw
In response to Re: pivoting data?  (Joy Smith <freestuffanddeals@gmail.com>)
List pgsql-general
<meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
    body p { margin-bottom: 0cm; margin-top: 0pt; }

  <body style="direction: ltr;"
    bidimailui-detected-decoding-type="latin-charset" bgcolor="#ffffff"
    text="#000000">
    On 09/08/2011 03:15 PM, Joy Smith wrote:
    <blockquote
cite="mid:CAJqhhiNtZKYxQjhXBAkGcXqopDghbUMB87crhoKDQ5HxgFrQaA@mail.gmail.com"
      type="cite">Hello Chris, yes that does seem to be a lot cleaner -
      though it does one thing that is not right - 
      ie)
      add to the previous data
       insert into modvalues
        (parties,baloons,color,dayofpurchase,amountpur) values
        > ('1','big','red','1/2/2011',4);




      then the output looks like:


      baloons     color        jan first       jan second    
jan
        third
      big             red            7
      big             green                
         14 
      big                 blue              
           3 
      big                  red            
              4 


      instead of looking like this(having big red only show up once
        with the new value under jan second):



        baloons     color        jan first       jan second    
jan
          third
        big             red            7    
               4 
        big             green                
         14 
        big                 blue            
             3 





      thank you for your help and ideas

    You'll want to group by baloons,color and probably take a sum of
    each of the case statements.

    Sim

pgsql-general by date:

Previous
From: Joy Smith
Date:
Subject: Re: pivoting data?
Next
From: Lincoln Yeoh
Date:
Subject: Re: conditional insert