6

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
devios1
  • 36,899
  • 45
  • 162
  • 260
  • 4
    It seems to be sensitive to spacing between `group_concat` and the opening parenthesis. Can you verify you have no spaces there in the actual query you were running? Source: http://www.dreamincode.net/forums/topic/247573-distinct/ – mellamokb Apr 27 '12 at 18:04
  • That's a possibility--I think phpmyadmin is transforming the query before passing it to MySql. It doesn't appear to be putting a space before the opening parenthesis though, but perhaps it's doing something else MySql doesn't like. – devios1 Apr 27 '12 at 18:20
  • 1
    Have you tried investigating the MySQL general query log to see exactly what query PHPMyAdmin is executing? – eggyal May 22 '12 at 18:56
  • Not a bad idea. I'll investigate. – devios1 May 22 '12 at 23:39
  • Yep. It is indeed inserting a space before the opening parenthesis. Bugger. It's probably just a bug in this old version of PhpMyAdmin that I'm using and can't change. Argh. – devios1 May 23 '12 at 00:19

1 Answers1

1

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;
Ed Massey
  • 449
  • 4
  • 5