ClanCats/Hydrahon

how to do GROUP_CONCAT using Hydrahon

Closed this issue · 1 comments

dht20 commented

im trying to do

SELECT id , GROUP_CONCAT(name)
like this
select("id, GROUP_CONCAT(name) ")

but i getting problemes , how can i do it properly?

Hello there,

You can use the Func or Expression object.

use ClanCats\Hydrahon\Query\Sql\Func;

$h
    ->table('stats')
    ->select(['id', new Func('GROUP_CONCAT', 'name')])
    ->execute();

Result:

select `id`, GROUP_CONCAT(`name`) from `stats`