How to get the following output in mysql table?
source table:
id values
1 a
2 b
3 c
4 d
5 e
Result:
id values
1 a
2 ab
3 abc
4 abcd
5 abcde
SELECT a.id, (@inc := concat(@inc, a.name)) AS Name
FROM mytable a, (SELECT @inc:= '') c ORDER BY a.id ASC
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句