Looping updates - better way to do this?
问题 I am stuck on this problem. I am thinking that I may need a looping update (if that exists), but maybe there is a better way? I am working with claims drug prescription data, so essentially 5 columns User, Drug, RxStartDate, DaySupply, and 'RxEndDate' = dateadd(dd, DaySupply-1, RxStartDate) If the same user has 2 prescriptions that overlap (Rx1 EndDate >= Rx2 StartDate), then I need to sum the DaySupply together. Once I sum the DaySupply, the RxEndDate will extend and I need to check again if