1

I have table which have Column EmployeeID, AccountID,updated date. Each row have Data for Account if it changes on date. If no change then there is no record for that AccountID on that date. Example

EmployeeID  AccountID      UpdatedDate
1775    1   2010-12-04 00:00:00.000
1775    1   2010-08-13 23:59:59.000
1775    1   2010-08-13 00:00:00.000
1775    2   2010-12-04 00:00:00.000
1775    3   2010-12-04 00:00:00.000
1775    4   2010-12-04 00:00:00.000
1775    5   2010-12-04 00:00:00.000
1775    6   2010-12-04 00:00:00.000
1775    7   2010-12-04 00:00:00.000
1775    7   2010-06-29 23:59:59.000

I have to get value of each account for each person on each day . if there is no value on current day then it should take last update value from previous day based on Max update date value. and show the result like

EmployeeID,Date, Values of each account.
1775;20120307;45;0;0;0;0;0;0;0;0;0;0;504;0;0;25.0;0.0;0.0;0.0;0.0;0.0;0.0;100;;;;;

Can any one help me?

D'Arcy Rittich
  • 167,292
  • 40
  • 290
  • 283
  • What database are you using? Are you looking for the values on one arbitrary date or on a range of dates at the same time? If a range of dates, do you have a calendar table? – Gordon Linoff Jun 04 '12 at 13:18
  • What part are you having trouble with? Getting the correct value? Getting values for every day? – D'Arcy Rittich Jun 04 '12 at 13:18

1 Answers1

0

You can either create a table of dates and left join against that, or create your dates dynamically as described here: generate days from date range

Community
  • 1
  • 1
D'Arcy Rittich
  • 167,292
  • 40
  • 290
  • 283