September 9, 2009 at 11:42 pm
hi.........
i have a table like this.
id productsales saledate
----------------------------------------------------
1 2 09-09-2009
2 4 10-09-2009
3 2 09-08-2009
4 4 10-08-2009
5 2 09-07-2009
6 4 10-07-2009
i need query for month wise total sales product.
id productsales saledate
----------------------------------------------------
1 6 01-09-2009
3 6 01-08-2009
5 6 01-07-2009
like this.. it is posible please send me query for this
Thanks
Dastagiri.D
September 10, 2009 at 12:24 am
hi,
Try this
select min(id),sum(productsales),
min(CAST(STR(MONTH(saledate))+'/'+STR(01)+'/'+STR(YEAR(saledate)) AS DateTime))
from MYTABLE
group by month(saledate),Year(saledate)
September 10, 2009 at 12:36 am
How does the id tie into this? From what I can tell it is nothing more than a row identifier. Am I wrong?
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply