I have this select output:
lastname, firstname, middle, customfieldlabel, customfieldvalue, access
Smith, Robert, A, Union, SA, 649 ALWAYS
Smith, Robert, A, Building ID, 649, 649 ALWAYS
Smith, Robert, A, EMPLOYEE #, 20526, 649 ALWAYS
Smith, Robert, A, Employment Status, Active, 649 ALWAYS
Smith, Robert, A, Position, Caretaker, 649 ALWAYS
Berry, Leon, L, EMPLOYEE #, 25632, 685 RS
Berry, Leon, L, EMPLOYEE #, 25632, 819 EX
Berry, Leon, L, Union, SA, 685 RS
Berry, Leon, L, Union, SA, 819 EX
These came from third party tables and cannot be changed. I want the value of the customfieldlabel as the column name and the customfieldvalue as the values for the corresponding customfieldlabel. If there is more than one access value then create more than 1 record.
I want this output to look like this after some manipulation.
lastname, firstname, middle, union, building id, employee #, employment status, position, access
Smith, Robert, A, SA, 649, 20526, Active, Caretaker, 649 ALWAYS
Berry, Leon, L, SA, , 25632, , , 685 RS
Berry, Leon, L, SA, , 25632, , , 819 EX