From: | "Hengky Liwandouw" <hengkyliwandouw(at)gmail(dot)com> |
---|---|
To: | "'pgsql-general General'" <pgsql-general(at)postgresql(dot)org> |
Subject: | Return and sql tuple descriptions are incompatible |
Date: | 2014-04-24 14:59:51 |
Message-ID: | 006601cf5fcd$da992e00$8fcb8a00$@com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
I have the following crosstab command :
Select * from crosstab($$select produkid, warehouseid,onhand from vwtest
order by 1,2$$)
as t (produkid VARCHAR, warehouseid integer)
vwtest :
CREATE OR REPLACE VIEW public.vwtest (
produkid,
warehouseid,
onhand)
AS
SELECT dt.produkid,
dt.warehouseid,
sum(dt.awal + dt.ttlmsk - dt.ttlklr) AS onhand
FROM (
SELECT tblstockawal.kodebarang AS produkid,
tblstockawal.warehouseid,
sum(tblstockawal.qty) AS awal,
0 AS ttlmsk,
0 AS ttlklr
FROM tblstockawal
GROUP BY tblstockawal.kodebarang, tblstockawal.warehouseid
UNION
SELECT tbltransaksi.kodebarang AS produkid,
tbltransaksi.warehouseid,
0 AS awal,
sum(tbltransaksi.masuk) AS ttlmsk,
sum(tbltransaksi.keluar) AS ttlklr
FROM tbltransaksi
GROUP BY tbltransaksi.kodebarang, tbltransaksi.warehouseid
) dt
GROUP BY dt.produkid, dt.warehouseid;
The crosstab command didn't work with error : Return and sql tuple
descriptions are incompatible.
I have tried to change productid type to text and warehouseid to float8 and
the problem still not solve.
What is wrong with the command ?
Thanks
From | Date | Subject | |
---|---|---|---|
Next Message | Gunnar "Nick" Bluth | 2014-04-24 16:07:10 | Re: Patched odbc_dfw for PG >= 9.2 - compiles & works but has issues with NULL representation in ODBC?!? |
Previous Message | Adrian Klaver | 2014-04-24 14:43:27 | Re: Request for Unsubscribe |