You are on page 1of 1

select distinct id,case when month(tanggal)<2 then tanggal else null end as tanggal, case when month(tanggal)<2 then

'Saldo bulan ini' else uraian end as uraian, case when month(tanggal)=2 then nilai else null end as nilai, case when month(tanggal)=2 then (select sum(nilai) from tabel t where t.id<=id) else (select sum(nilai) from tabel where month(tanggal)<2) end as saldo from tabel. Saya sudah coba dan berhasil, tapi apakah ada jalan lain ya?

You might also like