对账单月字段按逗号分隔形成多条数据
程序员文章站
2022-10-18 10:28:23
''' SELECT a.id, substring_index(substring_index(a.bill_ids, ',', b.id), ',', 1) bill_ids, a.status, a.card_name FROM (SELECT id, bill_ids,status,card ......
'''
select a.id,
substring_index(substring_index(a.bill_ids, ',', b.id), ',', -1) bill_ids,
a.status,
a.card_name
from (select id, bill_ids,status,card_name
from af_repayment
where bill_ids<>' ') a
join af_activity_model b on b.id <= (length(a.bill_ids) - length(replace(a.bill_ids, ',', ''))+1)
order by a.id
'''
上一篇: 子查询(极客时间)
下一篇: 创建以.xxx开头的文件夹的方法