php - Insert into Select with group concat -


hi have table has values

 domain                 user              groups  test_at_test.com         john              first  test_at_test.com         mary              second  test_at_test.com         john              second 

etc..

i want group concat table , insert values new table or update current table dont have problem , have new table this

domain                user              groups test_at_test.com         john              first,second test_at_test.com         mary              second 

i write following command error column count doesn't match value count @ row 1 insert newtable select * , group_concat(groups) from table group by user order domain

your new table has 3 columns in select result set have 4 columns need specify columns in select statement

insert      newtable  select `domain`, `user`,  group_concat(groups)   table group  user  order domain 

demo

note result truncated maximum length given group_concat_max_len system variable, has default value of 1024. value can set higher, although effective maximum length of return value constrained value of max_allowed_packet.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -