Rows to columns query

From: mike <mike(at)redtux1(dot)uklinux(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Rows to columns query
Date: 2004-05-10 16:29:48
Message-ID: 1084206588.8158.9.camel@datacontrol
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Does anyone know if this is feasable

I have two tables

one has inv_id,amount,date, cheque no

the second has
inv_id, amount , code (this relate to type of expenditure)

There is a one to many relationship on inv_id

What I want to do is

Group all the fields in the first table (easy), but then have the
grouped values in the 2nd table appearing as values in the columns ie

inv_id, cheque, amount_vote1,amount_vote2,amount_vote3 etc

Is this doable/feasable (preferably in a view)

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Casey Allen Shobe 2004-05-10 16:35:10 Re: Fwd: Favorite DB poll on ORA
Previous Message scott.marlowe 2004-05-10 16:27:33 Re: basic question (shared buffers vs. effective cache