我需要将此mysql查询转换为Yii1框架

时间:2018-06-26 13:02:04

标签: mysql yii1.x

我正在尝试将SQL查询转换为yii 1。 这是我的SQL查询

select t.project_category,t.name,t.status,t.est_end_date,t.est_start_date,t.created_by, sum(x.tam),sum(x.w), AVG(x.percentage) as z,AVG(x.per_hr_cost) as per_hr_cost,AVG(x.per_head_cost) as per_head_cost, x.time as time from

(

SELECT Userstory.worked_hours as w, Userstory.tot_amt as tam, (Userstory.percentage) AS percentage, Userstory.project_id,dailyLogs.from_time as time,(Userstory.per_hr_cost)as per_hr_cost,(Userstory.per_head_cost)as per_head_cost FROM `task_userstory_estimations` `Userstory`   LEFT OUTER JOIN `task_daily_logs`  `dailyLogs` ON (`dailyLogs`.`story_est_id`=`Userstory`.`id`) WHERE (Userstory.project_id  IN ('101' )) 

AND `from_time` >= '2018-06-21 00:00:00' AND `to_time` <= '2018-06-23 00:00:00'  GROUP BY Userstory.id
)

 x join task_projects t on t.id = x.project_id

0 个答案:

没有答案