If there is a duplicate please point me to it. I don't know what keywords to use to search for this situation.
I have this table:
name | read | sum1 | sum2
--------+-------+-------+-----
A | 1 | 2.0 | 1.3
A | 2 | 0.4 | 4
B | 1 | 0.2 | 0.1
B | 2 | 1.0 | 3.3
What I want is this:
name | r1_sum1 | r1_sum2 | r2_sum1 | r2_sum2
--------+---------+----------+---------+--------
A | 2.0 | 1.3 | 0.4 | 4
B | 0.2 | 0.1 | 1.0 | 3.3
So it's like the rows are grouped by the read, and name columns. How do I do this in psql?
readtake a fixed number of values, or could the desired query potentially return arbitrarily many columns?readalternates from 1 to 2