shaddf Posted September 4, 2015 Share Posted September 4, 2015 I have this query : select GROUP_CONCAT(Other_type)as projtype2,PrT_id from _Otherproject_typetbl,_project_typetblwhere _Otherproject_typetbl.Other_id=_project_typetbl.Other_id and Project_id=in_projid; and it gives this result: +-----------+--------+| projtype2 | PrT_id |+-----------+--------+| All_other | HR_3 |+-----------+--------+1 row in set (0.04 sec) I would to set the value incase it is "Allother" to be set to empty or null in any of the columns +-----------+--------+| projtype2 | PrT_id |+-----------+--------+| null | HR_3 |+-----------+--------+1 row in set (0.04 sec) Quote Link to comment Share on other sites More sharing options...
ginerjm Posted September 4, 2015 Share Posted September 4, 2015 Is this an sql question? Perhaps you want to try a different forum? Sounds like a situation for a CASE statement. Quote Link to comment Share on other sites More sharing options...
shaddf Posted September 4, 2015 Author Share Posted September 4, 2015 Is this an sql question? Perhaps you want to try a different forum? Sounds like a situation for a CASE statement. It is a mysql question .how can Iselect data while replacing all returned columns with "All_other as null" Quote Link to comment Share on other sites More sharing options...
Barand Posted September 4, 2015 Share Posted September 4, 2015 SELECT GROUP_CONCAT(NULLIF(Other_type, 'All_other') as projtype2, ... Quote Link to comment Share on other sites More sharing options...
Solution shaddf Posted September 5, 2015 Author Solution Share Posted September 5, 2015 SELECT GROUP_CONCAT(NULLIF(Other_type, 'All_other') as projtype2, ... thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.