首页 > 数据库技术 > 详细

mysql 逗号分隔成多列数据

时间:2019-03-19 10:15:43      阅读:539      评论:0      收藏:0      [点我收藏+]

说明 t_split  是临时表,分割几个,里面id字段分别是1-5
SELECT
substring_index( substring_index( a.content, ‘,‘, b.id + 1 ), ‘,‘,- 1 ) product_id
FROM
t_exhibition_booth_cell a
JOIN t_exhibition_booth ON t_exhibition_booth.id = a.booth_id
JOIN t_exhibition ON t_exhibition.id = t_exhibition_booth.exhibition_id
JOIN t_split b ON b.id <= ( length( a.content ) - length( REPLACE ( a.content, ‘,‘, ‘‘ ) ) + 1 )
WHERE
t_exhibition.CODE = ‘homepage5.18‘

mysql 逗号分隔成多列数据

原文:https://www.cnblogs.com/zhangjian816/p/10556681.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!