| От | 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 по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера