Coba ini
select A.NOPER,(select sum(b.nilai) from tablenya B where A.noper=B.noper and B.kode='D') as NilaiD,
(select sum(C.nilai) from tablenya C where A.noper=C.noper and C.kode='K') as NilaiK
from Tablenya A group by A.NOPER
CMIIW,
Salam
Ronald Irawan
Pt. Sanghiang Perkasa
Gd. Graha Kirana Lt.5
Jl Yos Sudarso Kav.88
Jakarta
| "Eko Yahoo" <[EMAIL PROTECTED]>
Sent by: [email protected] 13/07/2006 01:51 PM
|
|
misal saya pny tabel seperti ini
Bukti Noper nilai kode
K-1 11.01.001.0001 9000 D
K-2 11.01.001.0001 8000 K
K-3 11.01.001.0001 8500 D
K-1 11.01.001.0002 6000 D
K-2 11.01.001.0002 7000 K
K-3 11.01.001.0002 8500 D
select A.NOPER,(select sum(b.nilai) from tablenya B where A.noper=B.noper and B.kode='D') as NilaiD,
(select sum(C.nilai) from tablenya C where A.noper=C.noper and C.kode='K') as NilaiK
from Tablenya A group by A.NOPER
gimana query-nya agar menjadi
noper sum(nilai dg kode 'D') sum(nilai dg kode 'K')
11.01.001.0001 17500 8000
11.01.001.0002 14500 7000
