Crosstab-style query in pure SQL

Поиск
Список
Период
Сортировка
От dev@archonet.com
Тема Crosstab-style query in pure SQL
Дата
Msg-id 1493.192.168.1.16.1042462021.squirrel@mainbox.archonet.com
обсуждение исходный текст
Ответы Re: Crosstab-style query in pure SQL  ("Josh Berkus" <josh@agliodbs.com>)
Список pgsql-sql
TIA all

I have a table containing milestones achieved for projects, marked as
being in particular quarters.

CREATE TABLE milestones (   proj_id     int4,   sortorder   SERIAL,   qtr         int4,   description varchar(200)
);

Now I need the milestone descriptions output across the page like: proj_id | q1 | q2 | q3 | q4
and sorted according to "sortorder".

Judicious use of CASE can get me the quarterly columns but I need to
eliminate holes. Any clever ideas without resorting to procedural
solutions (either table function or application code)?

TIA

- Richard Huxton


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

Предыдущее
От: dev@archonet.com
Дата:
Сообщение: Re: Unique indexes not unique?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Unique indexes not unique?