Lee W, MVP
asked on
Concat multiple records into one line
Lets say you have a table:
Name City Date
Bob Anytown 2017-03-15
Bob Anytown 2017-03-21
Jim Sometown 2017-02-27
John Mytown 2017-03-06
John Mytown 2017-03-19
John Mytown 2017-03-25
I need to query the table so that my results are as follows:
Name City Dates
Bob Anytown 2017-03-15,2017-03-21
Jim Sometown 2017-02-27
John MyTown 2017-03-06,2017-03-19,2017 -03-25
I guess I'm asking how can I (can I?) have the results of a single field query reported in a single row rather than multiple rows?
Thoughts?
I know how I can use a programming language to manipulate this (VB/ASP for example), with looks, but I'm looking for a pure SQL way. IDEALLY MySQL way.
Name City Date
Bob Anytown 2017-03-15
Bob Anytown 2017-03-21
Jim Sometown 2017-02-27
John Mytown 2017-03-06
John Mytown 2017-03-19
John Mytown 2017-03-25
I need to query the table so that my results are as follows:
Name City Dates
Bob Anytown 2017-03-15,2017-03-21
Jim Sometown 2017-02-27
John MyTown 2017-03-06,2017-03-19,2017
I guess I'm asking how can I (can I?) have the results of a single field query reported in a single row rather than multiple rows?
Thoughts?
I know how I can use a programming language to manipulate this (VB/ASP for example), with looks, but I'm looking for a pure SQL way. IDEALLY MySQL way.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You're welcome.
Glad I could help!
Glad I could help!
ASKER