Jump to content
Larry Ullman's Book Forums

over_my_head

Members
  • Posts

    1
  • Joined

  • Last visited

over_my_head's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. I want to use the Query Builder as described in the yii manual: http://yiiframework.ru/doc/guide/en/database.query-builder I struggle with the documentation as it does not specify exactly where to put things. I have an SQL query that I know works on my MySQL database. I have tried formatting it according to the directions at the link I pasted above. My problem is that I don't understand where to put it. I am testing it on a table called people. The model is call People too. Here is the query as I understand, translated in yii: $user = Yii::app()->db->createCommand() ->select('Sum(IFNULL(yr1,0)) + IFNULL(yr2,0) + IFNULL(yr3,0) + IFNULL(yr4,0) + IFNULL(yr5,0) + IFNULL(yr6,0) + IFNULL(yr7,0) + IFNULL(yr8,0) + IFNULL(yr9,0) + IFNULL(yr10,0) AS Total ') ->from('people') ->group by('id');
×
×
  • Create New...