【发布时间】:2019-05-09 16:59:53
【问题描述】:
mysql 中是否有一个JSON 函数会忽略尝试添加元素(如果它已经存在)?例如:
update waitinglist SET
new = JSON_ARRAY_APPEND(new, '$', "orange")
where id=2;
update waitinglist SET
new = JSON_ARRAY_APPEND(new, '$', "orange")
where id=2;
现在我的数组看起来像:
["apple", "orange", "orange", "orange", "orange"]
但我希望它像一组一样工作,并且只是:
["apple", "orange"]
有没有办法做到这一点?
【问题讨论】:
标签: mysql json mysql-json