0

I have following data structure in MySQL database:

{
date: text
name: text
}

and a data set:

"2016-01-01" "a1"
"2016-01-02" "a2"
"2016-01-02" "a3"
"2016-01-03" "a4"

I would like to combine "name" field, if the "date" is a same in different rows. So at the end to have something like:

"2016-01-01" "a1"
"2016-01-02" "a2, a3"
"2016-01-03" "a4"

Of course I could iterate over results-array and build a new structure, like this one, programmatically.. but maybe its a faster way to do this directly in SQL Query?

a_horse_with_no_name
  • 497,550
  • 91
  • 775
  • 843
user1908375
  • 975
  • 1
  • 13
  • 32

0 Answers0