MüşteriKod Yıl Tutar
------------------------------
Diye bir tablom var
ben bu tablodaki kayıtları
| 2006 2007 2008 2009 2010
--------------------------------------------------------
MüşteriKod1|
MüşteriKod2|
MüşteriKod3|
MüşteriKod4|
5 yılın kayıtlarını Stored Procedure İle yukarıdaki tablo şekline aktarabilirmiyim.
select musteri_kodu, musteri_adi,
(select sum(miktar) from hareket where har_must_id = m.musteri_kodu and yil = 2006) as "2006",
(select sum(miktar) from hareket where har_must_id = m.musteri_kodu and yil = 2007) as "2007",
(select sum(miktar) from hareket where har_must_id = m.musteri_kodu and yil = 2008) as "2008",
(select sum(miktar) from hareket where har_must_id = m.musteri_kodu and yil = 2009) as "2009",
(select sum(miktar) from hareket where har_must_id = m.musteri_kodu and yil = 2010) as "2010"
from musteri m
order by m.musteri_adi