Get Last non-null cell in a row mysql

Viewed 904

I have a table in following structure:

id       performance_id     employee_comments   manager_comments
1        23                 NULL                Well done.
2        46                 NULL                Improve Speed
3        46                 Trying to improve   NULL
4        46                 NULL                Put more effort

In above structure, at a time, only one comments exist, either employee_comments or manager_comments, not both simultaneously.

I want to fetch last non-empty employee comments and manager_comments in a single row.

I need mysql query to display output as:

performance_id     employee_comments   manager_comments
23                 NULL                Well done.
46                 Trying to improve   Put more effort            
3 Answers
Related