We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How can i use group_concat of mysql in PHQL?

Hi There,

When i am using group_concat in PHQL, it gives me following error.

Syntax error, unexpected token IDENTIFIER

How can i use group_concat function in PHQL. It works fine in raw sql.

GROUP_CONCAT is non-standard sql, so you'll have to implement it in a db adapter dialect:

Example: https://github.com/phalcon/incubator/blob/master/Library/Phalcon/Db/Dialect/MysqlExtended.php

@lajosbencz,

Hi there,

Thank you for reply.

group_concat() works if i do not specify separators. for example

This work in PHQL.

select GROUP_CONCAT(username) from Users;

But this wont works in PHQL.

select GROUP_CONCAT(username SEPARATOR ':') from Users;

Why this happens?Any idea about it?