Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am having data like

MONTH amt amt1
1-apr-2015 100 10
1-apr-2015 20 20
2-apr-2015 20 20

1-apr-2016 100 10
1-apr-2016 20 20
2-apr-2016 20 20
so i need the sum of both, amt and amt1 according to month wise
Posted
Comments
Raje_ 28-Dec-15 5:28am    
try this way :
select sum(amt) as amt, sum(amt1) as amt1 from yourtable group by month

1 solution

Try:
SQL
SELECT YEAR([MONTH]) AS [Year], MONTH([MONTH]) AS [Month], SUM(amt) AS [Sum Amt], SUM(amt1] AS [Sum Amt1]
FROM MyTable
GROUP BY YEAR([MONTH]), MONTH([MONTH])
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900