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 order by planttype
OutPut::
planttype [50 Kg Bags]
Rohini 56150
Sneha 43950
KJL 353550
Suguna 1290850
Desired Output::
Bags Rohini Sneha KJL Suguna
50KgBags x xx xx xxx
My Query using Pivot::
select * 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
Result for this query:
Rohini Sneha KJL Suguna
x xx xx xxx
I need Bags also by doing I am getting error . Please Help me out