Re: Need sql to pull data from terribly architected table - Mailing list pgsql-general

From Gauthier, Dave
Subject Re: Need sql to pull data from terribly architected table
Date
Msg-id 0AD01C53605506449BA127FB8B99E5E13E0F8EDD@FMSMSX105.amr.corp.intel.com
Whole thread Raw
In response to Re: Need sql to pull data from terribly architected table  (Richard Broersma <richard.broersma@gmail.com>)
Responses Re: Need sql to pull data from terribly architected table
List pgsql-general

Thanks for the answers.  But I also have a predicate...

 

select col1,col2 from foo where col4='c4' and col5 <> 'xxx';

 

How is that done?

 

From: Richard Broersma [mailto:richard.broersma@gmail.com]
Sent: Tuesday, October 23, 2012 3:24 PM
To: chris@chriscurvey.com
Cc: Gauthier, Dave; pgsql-general@postgresql.org
Subject: Re: [GENERAL] Need sql to pull data from terribly architected table

 

 

On Tue, Oct 23, 2012 at 12:21 PM, Richard Broersma <richard.broersma@gmail.com> wrote:

On Tue, Oct 23, 2012 at 12:06 PM, Chris Curvey <chris@chriscurvey.com> wrote:

select my_ids.id 

, c1.value as col1

, c2.value as col2

, c3.value as col3

, c4.value as col4

, c5.value as col5

from my_ids

left join foo c1 on my_ids.id = c1.id

left join foo c2 on my_ids.id = c2.id

left join foo c3 on my_ids.id = c3.id

left join foo c4 on my_ids.id = c4.id

left join foo c5 on my_ids.id = c5.id


How about:

oops - I had some malformed air code
 

SELECT my_ids.id, ARRAY_AGG( ( property, value ) order by (property, value) )
  FROM my_ids

   GROUP BY id

ORDER BY id;


--
Regards,
Richard Broersma Jr.




--
Regards,
Richard Broersma Jr.

pgsql-general by date:

Previous
From: Richard Broersma
Date:
Subject: Re: Need sql to pull data from terribly architected table
Next
From: "David Johnston"
Date:
Subject: Re: Need sql to pull data from terribly architected table