condition - Add a word based on the column presents in MySQL -
consider coulumn_name1 = 'surgery'
consider coulmn_name2 = 'leg'
concat_ws(column_name1, ' on', column_name2)
consider column_name1 = null above operation give ' on leg' if coulumn_name1 null don't want add ' on '. i used
concat_ws( column_name1, if(coulumn_name1 null, '' ,' on '), column_name2)
it's working fine. it's looking ugly. there simpler way it? in advance.
Comments
Post a Comment