Reputation: 6270
I have a table
ID Skills
1 Python | Perl |
2 C# | Python |
3 Java | C++ | Perl |
The query should add the skill under skills if the skill doesn't exist but not add it, if it does. For example,
Update t1 set Skills = Concat(Skills,'Python | ') where ID = '1'
should not add python to the existing skills as it already exists.
but
Update t1 set Skills = Concat(Skills,'Python | ') where ID = '3'
should update 3
ID Skills
3 Java | C++ | Perl | Python |
I am able to concat but not conditional concat
Thanks
Upvotes: 0
Views: 136
Reputation: 24002
You can try not like
on skills
field.
Update t1
set Skills = Concat(Skills,'Python | ')
where Skills not like '%Python |%'
Upvotes: 1