Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Correct value at point in time

Author  Topic 

tinksi
Starting Member

2 Posts

Posted - 2011-09-14 : 09:49:40
Hi, I'm trying to create a script that shows we the total value based on 1 or more values. Each value I have is date tracked and 1 or more values can overlap with another.

Example data
Employee Value Date from Date to
100 100 01/01/2011 31/12/2011
100 50 01/10/2011 31/12/2012
100 2000 01/11/2011 30/11/2011

Required results
Employee Total value Date from Date tro
100 100 01/01/2011 30/09/2011
100 150 01/10/2011 31/10/2011
100 2150 01/11/2011 30/11/2011
100 150 01/12/2011 31/12/2011
100 50 01/01/2012 31/12/2012

I have achieved the results by breaking the data down to a daily total then aggregating back up again, however I have a lot of data and this is not efficient.

Any help with this would be greatly appreciated.

Thank you

tinksi
Starting Member

2 Posts

Posted - 2011-09-16 : 05:09:27
Problem solved
Go to Top of Page
   

- Advertisement -