我有这样的 tb1 表:
name email link
john myemail@gmail.com google
john myemail@gmail.com facebook
john myemail2@gmail.com twitter
....
....
and more
当我用查询调用数据时看起来像
SELECT name, email, group_concat(DISTINCT link SEPARATOR '/') as source
FROM tb1
group by email
结果像这样:
NAME EMAIL SOURCE
john myemail2@gmail.com twitter
john myemail@gmail.com facebook/google
....
....
and more
我想让结果看起来像:
NAME EMAIL SOURCE 1 SOURCE 2
john myemail2@gmail.com twitter
john myemail@gmail.com facebook google
是否可以仅通过查询得出结果?
注意:我想制作动态列源 1, 2, 3 ...., n