I am trying to implement a concatenation inside a SQL query. I need to use comma as separator between the values.
select concat(technology,',',secondary_technology,',',tertiary_technology) as Technology from deals
This works completely fine. But if there are no values in secondary and tertiary technology columns, the result looks something like
Blue Prism,,
So I need to put a condition if secondary and tertiary technologies are null, then the commas need to be omitted. I am using the following query:
select concat(technology,if(secondary_technology is null,'',','),secondary_technology,if(tertiary_technology is null,'',','),tertiary_technology) as Technology from deals
But this throws error saying Incorrect Syntax near the keyword 'if'. Incorrect Syntax near ','.
Please help me with this! I am using MS SQL Server 2014 Thank you in advance..