I have a select statement:
SELECT ID, A, B, C, D
FROM MyTable
GROUP BY ID, A, B, C, D
HAVING D >= '14/06/2013'
AND D <= '17/06/2013'
show this:
ID | A | B | C | D
--------------------------------------------
11 | 1370 | 0 | 0 | 14/06/2013
11 | 1370 | 100 | 0 | 15/06/2013
11 | 1470 | 400 | 0 | 16/06/2013
11 | 1870 | 0 | 300 | 17/06/2013
I Want the result is:
ID | min of D| Sum(B) | Sum(C) | max of D| MIN(D)
11 | 1370 | 500 | 300 | 1870 | 14/06/2013
How do I do that on SQL Server