Re: contrib/tablefunc crosstab

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: contrib/tablefunc crosstab
Дата
Msg-id 41127A0B.5030807@joeconway.com
обсуждение исходный текст
Ответ на contrib/tablefunc crosstab  (Caleb Simonyi-Gindele <csg@bordervet.ca>)
Список pgsql-sql
Caleb Simonyi-Gindele wrote:
> My problem is that the rows are populated from right to left irrespective of
> the column. So the $561.99 in vet1 actually belongs to vet2. There are never
> any blank cells in the middle or start of a row - they always come at the
> end. How do I get the amount for that date into the appropriate column?

You either need to be sure there are no "gaps" in your source rows 
(provide one row for every category for each group, e.g. by doing an 
outer join) or use the hashed version of the function. Search the README 
for:

crosstab(text source_sql, text category_sql)

That is the hashed version that will do what you're looking for.

HTH,

Joe


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

Предыдущее
От: Caleb Simonyi-Gindele
Дата:
Сообщение: contrib/tablefunc crosstab
Следующее
От: Michalis Kabrianis
Дата:
Сообщение: Sum and count weird results