Reputation: 19
please help me to join these two selects:
SELECT IFNULL(sum(estimated_hours * t2.man_hour),0) as
estimated from project_has_tasks t1 left join users t2
on t1.user_id = t2.id group by project_id
SELECT IFNULL(sum(TIME_FORMAT(SEC_TO_TIME
(time_spent),'%k.%i' )* t2.man_hour),0) as time_spent_cost FROM project_has_tasks t1
left join users t2 on t1.user_id = t2.id group
by project_id
Wanna to get:
| estimated | time_spent_cost |
_______________________________
| 000000000 | 00000000 |
Upvotes: 1
Views: 24
Reputation: 9806
Simply put them in one query:
SELECT IFNULL(sum(estimated_hours * t2.man_hour),0) as
estimated, IFNULL(sum(TIME_FORMAT(SEC_TO_TIME
(time_spent),'%k.%i' )* t2.man_hour),0) as time_spent_cost
from project_has_tasks t1 left join users t2
on t1.user_id = t2.id group by project_id
Upvotes: 1