Grouping in the select statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bandtank
    Active Community Member
    • Mar 2017
    • 393

    #1

    Grouping in the select statement

    I need to use GROUP_CONCAT (or something similar) in a select statement. The following code does not work because GROUP_CONCAT is specified incorrectly, but the idea is conveyed correctly:
    Code:
        $query = $utils["entityManager"]
          ->getQueryBuilder()
          ->select(array(
            ...
            "GROUP_CONCAT('id')",
          ))
          ->from('Note')
          ->where(array(
            ...
          ))
          ->groupBy("parentType")
          ->build();​
    I have not been able to figure out how to do this. Any help would be greatly appreciated.
  • a.slyzhko
    Senior Member
    • Oct 2023
    • 113

    #2
    Read this article on how to use complex expressions. You will need to create custom function converter to use group concat.

    Comment

    Working...