James Taylor wrote:
> So, say I wanted to do a sum function, it would end up with something
> like:
>
> Company | Sum
> -------------------
> Globochem | 1130.84
> Toxichem | 1239.47
>
Same crosstab function mentioned the other day:
select company, sum(acct_bal) as "sum" from (select name, company,
acct_bal from crosstab('select id_customer, id_datatype, content from
mytable order by 1','select distinct id_datatype from mytable') as
(id_customer int, name text, company text, acct_bal numeric)) as ss
group by company; company | sum
-----------+--------- Toxichem | 1239.47 Globochem | 1130.84
(2 rows)
HTH,
Joe