Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySql GROUP_CONCAT failing when exporting from phpmyadmin

When I test a query using group_concat it works fine and outputs the proper comma-delimited list in the row. However, when I then click "Export" at the bottom of the resultset, I get an error saying #1630 - FUNCTION <databasename>.group_concat does not exist.

It appears to be treating the reference to GROUP_CONCAT as a user defined function. Is there a way to properly qualify the function name so it can find it when exporting? I haven't had problems with exporting before when not attempting to use group_concat.

Here is the query:

SELECT *, group_concat(distinct g.name) FROM `users` u
left join usergroupassoc a on u.userid = a.userid
left join usergroups g on a.usergroupid = g.usergroupid
where u.enddate is null and g.enddate is null group by u.userid
like image 640
devios1 Avatar asked Apr 27 '12 17:04

devios1


1 Answers

group_concat uses a comma as the default delimiter, which may be preventing phpmyadmin from generating your export file correctly.

Try specifying a semi-colon as the group_concat delimiter:

SELECT *, group_concat(distinct g.name SEPARATOR ';') FROM `users` u
left join usergroupassoc a on u.userid = a.userid
left join usergroups g on a.usergroupid = g.usergroupid
where u.enddate is null and g.enddate is null group by u.userid;
like image 98
Ed Massey Avatar answered Oct 23 '22 12:10

Ed Massey