现在有两个系列 id分别 1 3 如何根据series_follow查出来对应的花卉
把 flower_series和flowers这两个表名改一下就能用了。
select a.id,GROUP_CONCAT(follow_name) as flowers from ( SELECT a.id, replace(substring_index(substring_index(replace(replace(a.series_follow,'[',''),']',''),',',b.id+1),',',-1),' ','') as flowerid FROM flower_series a JOIN (SELECT (@ROW :=@Row + 1) as id FROM flowers,(SELECT @Row:=-1) s) b on b.id<(length(replace(replace(a.series_follow,'[',''),']','')) - length(REPLACE (replace(replace(a.series_follow,'[',''),']',''), ',', '')) + 1)) a join flowers b on a.flowerid=b.id group by a.id;