WurzelGummidge
Technical User
I would like to be able to return the LAST populated column for a range of columns.
I have a table with columns:
CUSTOMER,PRODUCT,M1,M2,M3,M4,M5,M6,M7,M8,M9,M10,M11,M12
The Mx Columns represent the last 12 months and contains a qty (number).
What i would like to do is find the LAST month of an order:
ie
Example Data:
M1 NULL
M2 NULL
M3 NULL
M4 NULL
M5 6
M7 3
M8 NULL
M9 10
M10 NULL
M11 NULL
M12 NULL
so in the above example, i would like to have '4' returned - ie LAST ORDERED 4 MONTHS AGO (M9 has last order qty in it)
I have a table with columns:
CUSTOMER,PRODUCT,M1,M2,M3,M4,M5,M6,M7,M8,M9,M10,M11,M12
The Mx Columns represent the last 12 months and contains a qty (number).
What i would like to do is find the LAST month of an order:
ie
Example Data:
M1 NULL
M2 NULL
M3 NULL
M4 NULL
M5 6
M7 3
M8 NULL
M9 10
M10 NULL
M11 NULL
M12 NULL
so in the above example, i would like to have '4' returned - ie LAST ORDERED 4 MONTHS AGO (M9 has last order qty in it)