Re: Selecting rows as if they were columns?

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: Selecting rows as if they were columns?
Дата
Msg-id 200310091014.09695.josh@agliodbs.com
обсуждение исходный текст
Ответ на Selecting rows as if they were columns?  (Kurt Overberg <kurt@hotdogrecords.com>)
Ответы Re: Selecting rows as if they were columns?  (Richard Huxton <dev@archonet.com>)
Список pgsql-sql
Kurt,

> I've got what I think should be a pretty simple problem- I just can't
> figure out how I'd do it.  Heck, I can't even figure out how I'd search
> for an answer to this problem.

This is an old common SQL problem ... the "crosstab" table.   There are 3 
standard ways to solve it, depending on the exact circumstances of your case.   
It's probably best if you buy Joe Celko's "SQL for Smarties, 2nd Ed.", which 
has a 50-page chapter on the topic and explores the methods in detail.

-- 
Josh Berkus
Aglio Database Solutions
San Francisco


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

Предыдущее
От: Jan Wieck
Дата:
Сообщение: Re:
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Selecting rows as if they were columns?