Re: Rows to columns query

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: Rows to columns query
Дата
Msg-id Pine.BSO.4.56.0405101356460.30260@leary.csoft.net
обсуждение исходный текст
Ответ на Rows to columns query  (mike <mike@redtux1.uklinux.net>)
Список pgsql-general

On Mon, 10 May 2004, mike wrote:

> 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
>

See contrib/tablefunc's crosstab functions.  You will need to know the
number of output columns in advance though.

Kris Jurka


В списке pgsql-general по дате отправления:

Предыдущее
От: Kris Jurka
Дата:
Сообщение: Re: nested elseif woes
Следующее
От: Ron St-Pierre
Дата:
Сообщение: Re: nested elseif woes