KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

How to use group_concat(an sql function) in koolreports? #2426

Closed Dev opened this topic on on Nov 10, 2021 - 4 comments

Dev commented on Nov 10, 2021

I am trying to run following query

$roles = TestDb::table("table1")

          ->select('Id', 'TypeId')
          ->group_concat('roles')
          ->groupby('TypeId')
          ->run();

But its throwing error

Message: Call undefined group_concat() method

Sebastian Morales commented on Nov 10, 2021

Are you using Dashboard framework or QueryBuilder package?

KoolReport commented on Nov 11, 2021

You can do this:

->select("group_concat('roles')")->alias("roles_concat")

Let me know if it works.

Dev commented on Nov 12, 2021

@KoolReport Yes, that works But a minor change

->select("group_concat(roles)")->alias("roles_concat")

Thanks!!!

KoolReport commented on Nov 12, 2021

You are welcome :D

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed
solved

None