mysql-我想导出这样的表格怎么整,求解!

SELECT
    a.TABLE11,
    a.TABLE22,
    
FROM
a





| 表1 | 表2 |
| 1 | a |
| 1 | b |
| 1 | c |
| 2 | aa |
| 2 | bb |
| 2 | cc |
通过group_concat()可以得到
| 表1 | 表2 |
| 1 |a, b,c |
| 2 | aa.bb..cc |

这样导出来的表格不是我想要的,我想要这种


| 表1 | 表2.1 | 表2.2 | 表2.3 |
| ------ | ------ | ------ | ------ |
| 1 | a | b | c |
| 2 | aa | bb | cc |

分隔符保持一致的情况下,这样可以实现你想要的效果

select 
    id,str,
    substring_index(str,':',1) str1,
    substring_index(substring_index(str,':',2),':',-1) str2,
    substring_index(substring_index(str,':',3),':',-1) str3
from(
    select 
        'a' as id,'1:2:3' as str
    UNION ALL
    select
        'b' as id,'a:b:c' as str) t

img