I am having a bit of toruble with filling down some values in SQL. Here is an example of the way my data is structured.
ID Date Value EndDate
A 1/1/17 500 6/1/17
A 2/1/17 489 6/1/17
A 3/1/17 480 6/1/17
A 4/1/17 475 6/1/17
A 5/1/17 460 6/1/17
A 6/1/17 0 6/1/17
A 7/1/17 0 6/1/17
B 4/1/17 784 8/1/17
B 5/1/17 801 8/1/17
B 6/1/17 0 8/1/17
B 7/1/17 0 8/1/17
B 8/1/17 0 8/1/17
B 9/1/17 0 8/1/17
B 10/1/17 0 8/1/17
C 2/1/17 980 7/1/17
C 3/1/17 564 7/1/17
C 4/1/17 647 7/1/17
C 5/1/17 500 7/1/17
C 6/1/17 0 7/1/17
C 7/1/17 0 7/1/17
C 8/1/17 0 7/1/17
For each group, I would like to fill down the value column to the point where the Date is equal to EndDate. The desired output would look like this
ID Date Value EndDate
A 1/1/17 500 6/1/17
A 2/1/17 489 6/1/17
A 3/1/17 480 6/1/17
A 4/1/17 475 6/1/17
A 5/1/17 460 6/1/17
A 6/1/17 460 6/1/17
A 7/1/17 0 6/1/17
B 4/1/17 784 8/1/17
B 5/1/17 801 8/1/17
B 6/1/17 801 8/1/17
B 7/1/17 801 8/1/17
B 8/1/17 801 8/1/17
B 9/1/17 0 8/1/17
B 10/1/17 0 8/1/17
C 2/1/17 980 7/1/17
C 3/1/17 564 7/1/17
C 4/1/17 647 7/1/17
C 5/1/17 500 7/1/17
C 6/1/17 500 7/1/17
C 7/1/17 500 7/1/17
C 8/1/17 0 7/1/17
Any suggestions? Thanks!