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)
 Dates Overlaping - Changes

Author  Topic 

XXOmar
Starting Member

1 Post

Posted - 2011-10-05 : 18:31:39
Here is what it is required. In a given time period regional pricing overrides national pricing. With the data that I currently got there are overlaps. I need to create a function in Excel or SQL that helps me modify date records ( both VALID FROM and VALID TO ), and assign the right price with the correct timeframe (wo overlaps). Any ideas?

Type PROV VALID_FROM VALID_TO PRICE
National QC 01-Jan-00 31-Aug-04 38
National QC 01-Sep-04 16-Oct-07 32.37
Regional QC 17-Oct-07 18-Dec-07 32.37
National QC 17-Oct-07 31-Dec-99 32.37
Regional QC 19-Dec-07 31-Jan-08 20.23
Regional QC 01-Feb-08 16-Dec-10 16.185
Regional QC 17-Dec-10 31-Jan-11 12.57
Regional QC 01-Feb-11 19-Apr-11 12.565
Regional QC 20-Apr-11 31-Dec-99 10.06

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-06 : 01:19:35
so what should be your output from above data?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -