i have table with 2 columns: date and points. I want to create a query that will return the sum of points for all days, including today. This is to generate a chart of points earned up and until today.
Edit: I think my question was clearer before ews edited it 🙂
With data like that
2012-01-01 1 2012-01-02 1 2012-01-02 2 same day as above (we can have many records for one day, you can think of it as a result of one game on that day) 2012-01-03 -1
I would like to see the result:
2012-01-01 1 2012-01-02 4 (1+1+2) 2012-01-03 3 (1+1+2-1)
I’m using SQL Server 2008. If you know how to do it in LINQ to Entities that would be great.
If you need cummulative, you should try this:
Edit:
Here is an SQL Fiddle to test it.