• Being quite old and used to managing resources, I am always looking for ways to make what I do faster, better and easier to use. When I tried to run the original, it ran forever before I killed it. I started out by pulling out pieces of the code, creating tables of the data needed to get the results. As left joins are very expensive, I first pulled the inner joined parts together to create a table. The Table was defined to include columns for all of the data that would later be needed. I then started coding updates to this table from the previously left joined tables. It was when I tried to used this process to update from the function that I realized where the issue was. I went back to the original and added the CTE and removed the join. I still think that my first method would decrease the time significantly by removing the left joins and replacing them all with updates. I just ran out of time to go that far.