Hi All
I have a set of data which contains fields 1 through 12 for months of the year and one field for the year with one row of data for each year and each customer. I am trying to produce a query to present 18 months worth of data per customer based on an input of current month and current year. EG Month 0 of the resulting data would be the current month, Month-1 would be last month and month+1 would be next from last year. I am thinking I just need to create 18 separate select queries and then a union query to bring the results together. Does anyone have any suggestions on an easier way?
Terr CustName Year 1 2 3 4 5 6 7 8 9 10 11 12 SIS CUSTOMER 1 2011 0 0 55.8 0 0 0 0 0 0 0 55.8 0 SIS CUSTOMER 1 2012 0 0 0 0 90 0 0 0 0 0 0 0 SIS CUSTOMER 1 2013 0 0 0 0 0 1170 0 0 0 0 -1170 0 SIS Customer 2 2011 0 0 300 0 0 0 0 0 0 0 0 0 SIS Customer 2 2012 0 0 0 14 0 0 126 0 0 0 0 0 SIS Customer 2 2013 0 0 0 0 0 0 0 0 0 0 450 0