select Planttype ,sum(noof50kgsbags*50)[50 Kg],sum(noof70kgsbags*70)[70 Kg] from K_FeedPlantEntryIndent WHERE (date BETWEEN '2013-04-01 00:00.000' AND getdate()) AND (attrited = 'True') group by planttype
Planttype 50 Kg 70 Kg Rohini 56150 220990 Sneha 43950 0 KJL 353550 2426130 Suguna 1290850 0
select '50KG' [Bags],*from (select planttype ,sum(noof50kgsbags*50)[50 Kg] from K_FeedPlantEntryIndent WHERE (date BETWEEN '2013-04-01 00:00.000' AND getdate()) AND (attrited = 'True') group by planttype)as t PIVOT ( sum([50 Kg]) for[planttype] in(Rohini,Sneha,KJL,Suguna) ) As t2
Bags Rohini Sneha KJL Suguna 50KG 56150 43950 353550 1290850
Bags Rohini Sneha KJL Suguna 50KG 56150 43950 353550 1290850 70KG x x x x
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)