mysql行转列逗号拼接_MySQL中将一列以逗号分隔的值行转列

MySQL中将一列以逗号分隔的值行转列

2020-04-09 17:24阅读:

5733cd8f907dbd0118ee89e4b7eafb82.png

sky9

Hello,我是一名互联网后台开发工程师,正在升级打怪。

关注

$sql = 'select

a.*,substring_index(substring_index(a.col,',',b.help_topic_id+1),',',-1)

order_id,o.store_code,o.goods_no,o.goods_size1,o.picking_supplier,t.original_name,t.tel,t.address,t.shop_name,t.taobao_username

from

(select *,order_id col from tianma_wms_line.l_refuse_pic) as

a

join

mysql.help_topic as b

on b.help_topic_id < (char_length(a.col) -

char_length(replace(a.col,',',''))+1)

left join tianma_wms_line.l_orders o on

o.other_order_id=substring_index(substring_index(a.col,',',b.help_topic_id+1),',',-1)

left join tianma_wms_line.l_trades t on o.trade_id=t.id

{$where}';

https://blog.csdn.net/github_33809414/article/details/86656216

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值