Doctrine 2: group by field alias (Error: '…' does not point to a Class. )

前端 未结 3 924
无人及你
无人及你 2021-01-23 06:20

I got this Doctrine query:

        select upper(substring(e.name, 1, 1)) first_letter
        from Application\\Models\\Exercise e
        group by first_letter
         


        
3条回答
  •  星月不相逢
    2021-01-23 07:09

    My guess is that it is looking for first_letter to be an Entity. This is similar problem in some sql queries where you can't use a computed attribute from the select statement as criteria. Try the following:

    select upper(substring(e.name, 1, 1)) first_letter
    from Application\Models\Exercise e
    group by upper(substring(e.name, 1, 1))
    order by upper(substring(e.name, 1, 1)) asc
    

提交回复
热议问题