On Sun, Jan 15, 2012 at 12:17 PM, plasmasoftware net
<administrator@plasmasoftware.net> wrote:
select j.kode_barang kode_barang,j.isi_Satuan from J_master_barang j order by j.kode_barang asc
display
kode isi
00000000000001 24
00000000000001B 12
00000000000001C 1
i want to make that become when i select my table.how to make this.
kode isi_A isi_B isi_C
00000000000001 24 12 1
I think you have to use crosstab, you can try this out...
select '000000000001' as Kode, sum(case when j.kode_barang='A' then isi else 0 end) as isi_A,
sum(case when j.kode_barang='B' then isi else 0 end) as isi_B,
sum(case when j.kode_barang='C' then isi else 0 end) as isi_C from j_master_barang;
---
Regards,
Raghavendra
EnterpriseDB Corporation