I have a view with the following structure:
areas employee_id complaint_type_id
a1 e1 c1
a2 e1 c1
a3 e2 c1
a1 e1 c2
.
Now in the code, I am fetching area
and complaint_type_id
for a particular employee from view. I want to display the complaint categories assigned to an employee for different areas.
The output I am getting is as follows:
area complaint_type_id
a1 c1
a2 c1
a3 c1
a1 c2
a2 c2
a3 c2
In this output, the areas are getting repeat for each kind of complaint id. I want to display complaint categories in a single row for a particular area
My desired output is as follows:
area complaint_type_id
a1 c1,c2
a2 c1,c2
a3 c1,c2
I tried using the group by
clause but in the output of the group by
areas are appearing twice for each complaint type. How can I achieve my desired output?