MErhaba arkadaslar benim bir tablom var ve bu tabloda sube ve ay sutunları var.
sube alanında sube isimleri, ay alanında ise 201201 şeklinde yıl ay birleşimi numeric degerler var. tabiiki burada sube ve ay birden fazla sayıda var ve benim istedigim bu ayları sutun haline getirmek ve subeleri sadece bir defa yazmak. asagıdaki sorguyu yazdım sql serverde calisiyor fakat VBA da hata veriyor.
Sql cumlesi asagıda
select sube, count(case when ay=201201 then 201201 end) as ocak,
count(case when ay=201202 then 201202 end) as subat,
count(case when ay=201203 then 201203 end) as mart,
count(case when ay=201204 then 201204 end) as nisan,
count(case when ay=201205 then 201205 end) as mayis,
count(case when ay=201206 then 201206 end) as haziran,
count(case when ay=201207 then 201207 end) as temmuz,
count(case when ay=201208 then 201208 end) as agustos,
count(case when ay=201209 then 201209 end) as eylul,
count(case when ay=201210 then 201210 end) as ekim,
count(case when ay=201211 then 201211 end) as kasim,
count(case when ay=201212 then 201212 end) as aralik
from Veri1 where bolge='ADANA' group by sube
VBA da ise Veri1 'i [Veri1$] olarak kullanıyorum
acil destek olabilirseniz sevinirim
sube alanında sube isimleri, ay alanında ise 201201 şeklinde yıl ay birleşimi numeric degerler var. tabiiki burada sube ve ay birden fazla sayıda var ve benim istedigim bu ayları sutun haline getirmek ve subeleri sadece bir defa yazmak. asagıdaki sorguyu yazdım sql serverde calisiyor fakat VBA da hata veriyor.
Sql cumlesi asagıda
select sube, count(case when ay=201201 then 201201 end) as ocak,
count(case when ay=201202 then 201202 end) as subat,
count(case when ay=201203 then 201203 end) as mart,
count(case when ay=201204 then 201204 end) as nisan,
count(case when ay=201205 then 201205 end) as mayis,
count(case when ay=201206 then 201206 end) as haziran,
count(case when ay=201207 then 201207 end) as temmuz,
count(case when ay=201208 then 201208 end) as agustos,
count(case when ay=201209 then 201209 end) as eylul,
count(case when ay=201210 then 201210 end) as ekim,
count(case when ay=201211 then 201211 end) as kasim,
count(case when ay=201212 then 201212 end) as aralik
from Veri1 where bolge='ADANA' group by sube
VBA da ise Veri1 'i [Veri1$] olarak kullanıyorum
acil destek olabilirseniz sevinirim
