When using the query builder I'm attempting to use a having clause that is a group concat that uses a order by to ensure the proper order. However I get an error "Syntax error, unexpected token ORDER, near to ' BY bar.bazId) '1,2,3" when I attempt this. The general query looks like
SELECT foo.* FROM foo JOIN bar ON bar.fooId = foo.id AND bar.bazId IN (1,2,3) GROUP BY foo.id HAVING GROUP_CONCAT(bar.bazId ORDER BY bar.bazId) = '1,2,3'
This works when directly running the sql in mysql workbench and works in the query builder if I remove ORDER BY bar.bazId. Is there a proper way to get this functionality using the query builder, is this a quirk of mysql that isn't supported or is this a bug?