Why does column alias not work in doctrine?

后端 未结 3 700
伪装坚强ぢ
伪装坚强ぢ 2021-01-11 19:19

My script is like this:

$query = Doctrine_Query::create ()
  ->select(\'count(p.product_id) as num_a\')              
  ->from ( \'ProductComments p\'          


        
3条回答
  •  无人及你
    2021-01-11 20:05

    This would not be valid SQL.

    SQL standard state that SELECT will be logically executed after having. So You need to repeat aliased code in having.

    Good advice. As long as You work with SQL consuming DBs stick as closely to SQL as possible.

提交回复
热议问题