''' 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
'''