BAH. I thought I was through with this, but I just found an outlier.
When testing with the this data:
INSERT INTO #MyTemp (Office, POID, DeliverySite, AmtDollars, StartDate, EndDate, DelSite_Order, POID_Order)
VALUES ('KTY4568', 1071581, 2056, 50.00, '01/30/2012', '07/31/2013', 1, 1),
('KTY4568', 1071578, 5943, 50.00, '08/01/2013', '09/02/2013', 1, 2),
('KTY4568', 1092732, 2056, 50.00, '09/03/2013', '12/12/2013', 1, 3)
I get
KTY4568 2056 $50.00 01/30/2012 12/12/2013
KTY4568 5943 $50.00 08/01/2013 09/02/2013
When I should be getting:
KTY4568 2056 $50.00 01/30/2012 07/31/2013
KTY4568 5943 $50.00 08/01/2013 09/02/2013
KTY4568 2056 $50.00 09/03/2013 12/12/2013
Thoughts?
EDIT: I think I may have to do these ones manually. Fortunately, there only appears to be about 9 offices affected by this.