I have a huge database which contains certain categories of products and their sales figures.
I want to find
CATEGORYWISE sale per Month.
I have written a query for that.
but I had to write 12 queries for 12 months.
This is a sample Query for Month April I am Posting.
select cm.name as April, sum(sd.Amount) as categorywisesell from categorymaster cm INNER JOIN LobAttributeValue lav on cm.categoryid = lav.valueid INNER JOIN AttributeMaster am on am.attributeid = lav.attributeid INNER JOIN salesdetail sd on sd.productid = lav.productid INNER JOIN salesmaster sm on sd.VoucherNo = sm.VoucherNo where cm.name = 'Blow Plast Ltd' and lav.attributeid <> 4 and sm.Date > '2009-04-01 00:00:00.000' and sm.Date < '2009-04-30 00:00:00.000' group by cm.name
This query is just for April.
I want one query to print all months sales figures.
Any Idea how can I print Sales figures for all months in single query.
Don't tell me to write procedure bcoz its not feasible for my applicaiton.