之前資料格式有點雜亂, 利用 group by 整理一下
交叉表三 Version 2
------------------------------------
select currency, purpose, sum(即期)as 即期,sum(現金) as 現金
From
(
SELECT *
FROM crosstab(
'select currency, purpose, currType, rate From exgRate',
'Select distinct currType from exgRate' )
AS t(
currency char(3),
purpose varchar(10),
"即期" numeric(18,6),
"現金" numeric(18,6)
) order by purpose, currency
) dt group by currency, purpose
沒有留言:
張貼留言