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

Group CONCAT Separator

Hello to all, i have an error. i wanna make a Group_Concat with phql. thats working fine so far but when i wanna use another SEPARATOR then i get an error. Is SEPARATOR not supported by phql? or is there another way to do it?

Other question, is ther a file where i can find all supported phql syntax?

Thanks, Pat



58.4k

Hey

Could you upload a code for this?

Hey Thien, for example:

$query = new \Phalcon\Mvc\Model\Query\Builder();
$query->addFrom('PaPhalconAuth\Entity\User')->columns('GROUP_CONCAT(anyfield)')->groupBy('name');

thats working and its getting separated with an "," automatically but in mysql you normally have the option that u can also set an seperator like that:

$query = new \Phalcon\Mvc\Model\Query\Builder();
$query->addFrom('PaPhalconAuth\Entity\User')->columns("GROUP_CONCAT(anyfield SEPARATOR ';')")->groupBy('name');

but thats not working with the phql. is there another solution? dont wanna make an extra callback.

thanks pat