Re: Function to Pivot data

Поиск
Список
Период
Сортировка
От Andrew Sullivan
Тема Re: Function to Pivot data
Дата
Msg-id 20020212114926.E30421@mail.libertyrms.com
обсуждение исходный текст
Ответ на Re: Function to Pivot data  (Bruno Wolff III <bruno@wolff.to>)
Ответы Re: Function to Pivot data
Список pgsql-general
On Mon, Feb 11, 2002 at 07:39:38AM -0600, Bruno Wolff III wrote:

> The way I did this for a tiny book database I have set up for my wife
> to keep track of books is to have an edition table, an author table and
> a table of edition author pairs. It isn't ordered, but it could be
> by adding another field to the edition, author pairs.

That was my original suggestion.  But then, how do you make sure that
every edition has only one first author, only one second, &c.?  Also,
you can't have a generic query which gets the authors for every book,
and shows them in the tabular output that was originally desired
(hence the pivot table).  You could, however, write some code outside
the database which would first query the book_author table, figure
out how many authors were necessary, and then build the real query
that way.

A
--
----
Andrew Sullivan                               87 Mowat Avenue
Liberty RMS                           Toronto, Ontario Canada
<andrew@libertyrms.info>                              M6K 3E3
                                         +1 416 646 3304 x110


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: index use again and again
Следующее
От: Masaru Sugawara
Дата:
Сообщение: Re: Optimizing nested loops in the query plan