我需要将这个mysql查询转换成yii1框架

zlwx9yxi  于 2021-06-24  发布在  Mysql
关注(0)|答案(0)|浏览(230)

我正在尝试将我的sql查询转换为yii1。这是我的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

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题