Question : aggregate function

SQL Server 2008:
I have the following table and I wanted to get the sum for each store for each month and display the month as well. The date field has records that span over a year for stores A,B,C,and D.
 
date      storename      online customers  on site customers
1/1/2009      A      100      200
1/1/2009      B      300      400
1/1/2009      C      200      200
1/1/2009      D      300      350
1/15/2009      A      100      200
1/15/2009      B      280      200
1/15/2009      C      100      200
1/15/2009      D      200      500
2/3/2009
2/18/2009
..
1/15/2010
1/30/2010
      I tried the following, but did not work:

select storename,sum(online),sum(onsite)
from table
Group by storename,datepart(YEAR,date),datePart(Month,date)            

Answer : aggregate function

set test as global var :

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
<html><head>
<script  language="javascript">
var test = "Hello World"; //global var
	function init() {
		cell1 = document.getElementsByTagName("td")[0];
		cell1.setAttribute('onmouseover','alert(test)');
	}
</script>
</head>
<body onload="init();">
<table width="320" height="200" border="2" bordercolor="#000000">
<tr><td></td></tr>
</table>
</body></html>
Random Solutions  
 
programming4us programming4us