Crosstab Confusion

Поиск
Список
Период
Сортировка
От Adam Sherman
Тема Crosstab Confusion
Дата
Msg-id C5C50165-6162-460C-8E13-A0A76D0B726B@sherman.ca
обсуждение исходный текст
Ответы Re: Crosstab Confusion  (Lee Hachadoorian <lee.hachadoorian@gmail.com>)
Список pgsql-sql
I'm really trying to understand how the tablefunc crosstab function works, to no avail.

I have a table that looks like this:

customer_id integer
date timestamp with time zone
amount numeric(10,4)

There are rows in this table every-time a customer gets charged an amount, which is multiple times per day.

I would like to get a result like this:

customer_id,day1,day2,day3,(…)
1,400.00,500.01,123.00,(…)

So, one row for each customer id and a column for every day in the current month. Anyone used crosstab for something
likethis? 

Thanks for your help,

A.


--
www.sherman.ca / +1-613-797-6819 / +1-646-233-3400

"When the burning husks of your startups warm the last of your bones, remember I told you so." - Zed



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

Предыдущее
От: Yeb Havinga
Дата:
Сообщение: Re: selecting rows tagged with "a" but not "b"
Следующее
От: Lee Hachadoorian
Дата:
Сообщение: Re: Crosstab Confusion