Reputation: 916
I am not much familiar with mysql here i am giving a portion of my query
(SELECT GROUP_CONCAT(Q.gender_id SEPARATOR ' , ') FROM path_career_gender_compatibility Q WHERE Q.data_entry_id = '1') AS career_gender_compatibility
here i am getting result as
1 , 2 , 3
but i want record like this
male,female,others
I dont know how to use a condition inside group_concat . I hope you all understand the problem any help is appreciable.
Upvotes: 0
Views: 1563
Reputation: 42763
Probably you need CASE expression
:
SELECT GROUP_CONCAT(case when Q.gender_id = 1 then 'male' when Q.gender_id = 2 then 'female' else 'other' end SEPARATOR ' , ')
FROM path_career_gender_compatibility Q
WHERE Q.data_entry_id = '1'
Upvotes: 1