not quite a cross tab query...

Поиск
Список
Период
Сортировка
Искать
От
Richard Greenwood
Тема
not quite a cross tab query...
Дата
Msg-id
ae9185aa0903051117n494f12fbo8c7306b9638d299b@mail.gmail.com
Список
Дерево обсуждения
not quite a cross tab query... Richard Greenwood <richard.greenwood@gmail.com>
Re: not quite a cross tab query... darren@ontrenet.com
Re: not quite a cross tab query... Richard Greenwood <richard.greenwood@gmail.com>
Re: not quite a cross tab query... Steve Atkins <steve@blighty.com>
Re: not quite a cross tab query... Richard Greenwood <richard.greenwood@gmail.com>
Hello pgsql listers,

I've got a problem that is similar to, but I don't think identical to,
a cross tab query. My data looks like:
  ID | CAT
  1  |   A
  1  |   B
  2  |   A
  2  |   C
So for each ID there may be many CAT (categories).
The client wants it to look like:
  ID | CATS
  1  |  A,B
  2  |  A,C
Where each ID is unique in the results, and the CAT values are
concatenated with a comma separator.

There are about 100 unique CAT values. They only way I can see to do
it is programatically with a for loop. But before I do that I wanted
to bounce it off the fine minds that inhabit this list.

Thanks,
Rich

-- 
Richard Greenwood
richard.greenwood@gmail.com
www.greenwoodmap.com
В списке pgsql-general по дате отправления
От: Joshua D. Drake
Дата:
От: A. Kretschmer
Дата:
Сообщение: Re: Postgres Cookbook
FAQ