Hi All,
I have a problem, I need to select the max value of a row and get the field(s) that its associated to.
Example:
ID MONTH1 MONTH2 MONTH3 MONTH4 MONTH5 MONTH6
1 22 33 32 56 234 234
I need to be able to select and retrieve ID, MONTH5 and MONTH6 (not the values but the column name) as my result set.
I know you can do a max(column1,column2,column3) and it returns the correct value but have no idea on how to get the column name.
Any help would be amazing.
I have a problem, I need to select the max value of a row and get the field(s) that its associated to.
Example:
ID MONTH1 MONTH2 MONTH3 MONTH4 MONTH5 MONTH6
1 22 33 32 56 234 234
I need to be able to select and retrieve ID, MONTH5 and MONTH6 (not the values but the column name) as my result set.
I know you can do a max(column1,column2,column3) and it returns the correct value but have no idea on how to get the column name.
Any help would be amazing.