From: | "Karl Grossner" <karl(at)clearedgedesign(dot)com> |
---|---|
To: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | a simple transform |
Date: | 2008-09-14 23:59:44 |
Message-ID: | 000601c916c5$f5f803d0$e1e80b70$@com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
I've thrashed at this transform for quite a while and come up empty. The
crosstab() functions, and the documented examples, all do something more
complex than I need. I can do this after the fact trivially in python with
the 'zip()' function, but I need it real-time from a view or function.
Of course I could be overlooking the obvious (it's happened before!)
I have this:
attr1 attr2 attr3
------ ------ ------
cat1 0.34 0.12 0.22
cat2 0.11 0.67 0.31
and need it transposed thus:
cat1 cat2
----- -----
attr1 0.34 0.11
attr2 0.12 0.67
attr3 0.22 0.31
in case it adds motivation (;^/), cat1 and cat2 are democrat & republican;
the attr's are campaign issues; the values are "aboutness" derived from a
text similarity measure
tia
Karl
From | Date | Subject | |
---|---|---|---|
Next Message | Claus Guttesen | 2008-09-15 10:04:55 | select from two tables |
Previous Message | Frank Bax | 2008-09-14 12:55:18 | Re: selecting current UTC time |