我尝试将KnownForTitles列拆分为4个单独的列,但无法使查询正常工作。
我试过使用子字符串和instr来选择逗号前面的结果,你能看出我哪里出错了吗
Select nameID, name,
substring_index(group_concat( Titleid order by nameID), ",", 1) KnownForTitles1,
substring(substring_index(group_concat( Titleid order by nameID), ",", 2), instr(substring_index(group_concat( Titleid order by nameID), ",",2)),",")
KnownForTitles2
from Person
inner join KnownForTitles using (nameid)
inner Join Media using (titleID)
group by nameID
order by nameID
这是我需要的结果格式:
1条答案
按热度按时间kpbwa7wx1#
您的风格:
不过,这一个看起来更干净: