mysql逗号分隔多行

SELECT
  id,
  SUBSTRING_INDEX(SUBSTRING_INDEX(uid, ',', n), ',', - 1) AS idFROM
  hd_check_plain,
  (SELECT
    @rownum := @rownum + 1 AS n
  FROM
    (SELECT
      @rownum := 0) r,
    hd_check_plain) X
WHERE n <= (
    LENGTH(uid) - LENGTH(REPLACE(uid, ',', '')) + 1
  )

 

posted @ 2023-12-19 18:41  _Lawrence  阅读(18)  评论(0编辑  收藏  举报