MySQL - 替换SELECT中的多个值

时间:2013-06-24 10:39:11

标签: mysql str-replace

我在http://sqlfiddle.com/#!2/18aed1

中创建了我的代码

我有两张桌子:

enter image description here

我需要使用name_group替换users表中的多个组,如下所示: enter image description here

我的代码是:

SELECT
      name,
      (SELECT name_group FROM groups WHERE id IN (REPLACE(REPLACE(groups ,'{','') , '}',''))) AS groups
FROM `users`

演示:enter link description here

谢谢

0 个答案:

没有答案