combine multiple rows value in mysql table

Satya

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
fortune
SELECT  a.id, (@inc := concat(@inc, a.name)) AS Name
FROM  mytable a, (SELECT @inc:= '') c ORDER BY a.id ASC

SQLFIDDLE DEMO

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

How to insert multiple rows from a table to another table based on date condition (PHP-MySQL-Query)?

来自分类Dev

Selecting and aggregating multiple rows in MySQL

来自分类Dev

Set sequential number in mysql table only where rows have same value

来自分类Dev

SQL Server: Insert Multiple Rows to a table based on a column in a different table

来自分类Dev

MySQL Grouping similar rows based on entries in a second table

来自分类Dev

R: Speed up combine(paste or paste0) operation for 39 millions rows and two columns in data.table

来自分类Dev

SparkSQL/Hive:相当于 MySQL 的 `information_schema.table.{data_length, table_rows}`?

来自分类Dev

How to change the value of this field in all the records of this MySql table?

来自分类Dev

指定要在dv.Table.Rows(x)(VALUE).ToString()中使用的行

来自分类Dev

Grouping multiple rows in R

来自分类Dev

MySQL mysql_num_rows();

来自分类Dev

Combine multiple xlsx File in single Xlsx File

来自分类Dev

Deactivate hover state on table rows in Bootstrap Table

来自分类Dev

Rows with max value of each group

来自分类Dev

MySQL过程的ALL ROWS参数

来自分类Dev

mysql_num_rows null

来自分类Dev

mysql_num_rows与mysql_numrows

来自分类Dev

Mysql_num_rows php / mysql的问题

来自分类Dev

Mysql_num_rows php / mysql的问题

来自分类Dev

MySQL ALTER TABLE挂起

来自分类Dev

Update Email in Mysql table

来自分类Dev

MySQL ANALYZE TABLE响应

来自分类Dev

Counting multiple value occurrences

来自分类Dev

Use Octave/Matlab combine multiple blobs in close proximity into one blob

来自分类Dev

R: crop multiple pngs and combine them into a single plot

来自分类Dev

SQL Table Rows to Columns - Possible PIVOT?

来自分类Dev

Javascript - add multiples rows in html table

来自分类Dev

How to limit the cloned table rows to 4?

来自分类Dev

Watchkit: table with two templates in dynamic rows

Related 相关文章

  1. 1

    How to insert multiple rows from a table to another table based on date condition (PHP-MySQL-Query)?

  2. 2

    Selecting and aggregating multiple rows in MySQL

  3. 3

    Set sequential number in mysql table only where rows have same value

  4. 4

    SQL Server: Insert Multiple Rows to a table based on a column in a different table

  5. 5

    MySQL Grouping similar rows based on entries in a second table

  6. 6

    R: Speed up combine(paste or paste0) operation for 39 millions rows and two columns in data.table

  7. 7

    SparkSQL/Hive:相当于 MySQL 的 `information_schema.table.{data_length, table_rows}`?

  8. 8

    How to change the value of this field in all the records of this MySql table?

  9. 9

    指定要在dv.Table.Rows(x)(VALUE).ToString()中使用的行

  10. 10

    Grouping multiple rows in R

  11. 11

    MySQL mysql_num_rows();

  12. 12

    Combine multiple xlsx File in single Xlsx File

  13. 13

    Deactivate hover state on table rows in Bootstrap Table

  14. 14

    Rows with max value of each group

  15. 15

    MySQL过程的ALL ROWS参数

  16. 16

    mysql_num_rows null

  17. 17

    mysql_num_rows与mysql_numrows

  18. 18

    Mysql_num_rows php / mysql的问题

  19. 19

    Mysql_num_rows php / mysql的问题

  20. 20

    MySQL ALTER TABLE挂起

  21. 21

    Update Email in Mysql table

  22. 22

    MySQL ANALYZE TABLE响应

  23. 23

    Counting multiple value occurrences

  24. 24

    Use Octave/Matlab combine multiple blobs in close proximity into one blob

  25. 25

    R: crop multiple pngs and combine them into a single plot

  26. 26

    SQL Table Rows to Columns - Possible PIVOT?

  27. 27

    Javascript - add multiples rows in html table

  28. 28

    How to limit the cloned table rows to 4?

  29. 29

    Watchkit: table with two templates in dynamic rows

热门标签

归档