I have a tables that contains the below values.
region state
--------- ----------
region01 state01
region01 state02
region02 state03
On the above data, I want to get all the regions in just single row that’s why I’ve to used the GROUP_CONCAT. But it seems that my below query duplicates the region01 and having a result of
region01;region01;region02
Can any one help me on how to improve the below query so that the return value should not duplicates the same data
SELECT GROUP_CONCAT(region SEPARATOR ';') AS region
FROM table1
WHERE field1='BUSINESS01';
Add a
DISTINCT.From the MySQL manual: