Cumulative DQL with Doctrine

后端 未结 2 1327
情歌与酒
情歌与酒 2021-01-15 18:54

Im having a hard time working out a proper DQL to generate cumulative sum. I can do it in plain SQL but when it comes to DQL i cant get hold of it.

Here is how it lo

2条回答
  •  时光说笑
    2021-01-15 19:38

    You just specify the sum in your select part of the DQL:

    $query = Doctrine_Query::create()
       ->select('sum(amount)')
       ->from('some_table');
    

    Check out this page in the Doctrine documentation for more info.

提交回复
热议问题