I have this sample code, not sure where I am going wrong. I am going wrong somewhere at the Inner Join.
I have attached the sample data.
What I want to do is pivot the 2 Amount columns to the right for each value of Days. So Days 0 = CurrentAmount, 1 = PreviousAmount, 2 = 30Days. This is Ageing Data. Eventually at the end I want to delete the InputTable and just work with the Outputtable which will then have 60 Values for Amount and 60 Values for AmountVat. Our Clients then need this in this format in a qvd file, but that I can do. We could be summing the values for years 1, 2 3 4 etc, but for now I just need to pivot the data. This is just a sample so ignore that it is coming from xls. We get the data from SQL. What is the most effective way of doing this, and it my way is OK what am I missing on the scripting?