From: | Joe Conway <mail(at)joeconway(dot)com> |
---|---|
To: | Caleb Simonyi-Gindele <csg(at)bordervet(dot)ca> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: contrib/tablefunc crosstab |
Date: | 2004-08-05 18:18:51 |
Message-ID: | 41127A0B.5030807@joeconway.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2004-08-06 05:22:33 | Re: SQL syntax extentions - to put postgres ahead in the race |
Previous Message | Caleb Simonyi-Gindele | 2004-08-05 17:21:05 | contrib/tablefunc crosstab |