Last active
February 28, 2020 04:03
-
-
Save Yiling-J/278fd559362d65f2df4742dd4b180034 to your computer and use it in GitHub Desktop.
mysql comma-separated string remove duplicate(using mysql 5.7)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- this will return no duplicate json array, then you can use replace to get normal string | |
SELECT JSON_KEYS(JSON_MERGE(concat('{"', Replace('martini,martini,coffee,espresso', ',', '":1,"'), '":1}'), concat('{"', Replace('martini,martini,coffee,espresso', ',', '":1,"'), '":1}'))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment