I have a table with two columns:
- City
- Country
I want a result set that includes all of the City values. For the rows that the same City value I want to also include the country column. An example of my desired result set is as follows:
City
----------------
Chicago
New York
Toronto
London, Canada
London, England
Los Angeles
Note
The point of interest is the duplicate city names of “London” include a comma, space, and the country name to differentiate them.
How do I achieve this with a MySQL statement? I have tried a couple of things using group by and having clauses but I couldn’t get my desired result.
Use: