Quantcast
Channel: Oracle, MySQL, Sybase, Informix and other databases
Viewing all articles
Browse latest Browse all 1350

Mysql query

$
0
0
select p.project_name,u.first_name as ProjectManager,a.first_name as leadDeveloper,b.first_name as leadQA
       ,sum(case when DATE_SUB(m.actual_start,INTERVAL 6 DAY) = '2014-06-24' then worked  else 0 end) as '1'
        ,sum(case when DATE_SUB('2014-06-23', INTERVAL 6 DAY) = '2014-06-17' then worked else 0 end) as '2'
        ,sum(case when DATE_SUB('2014-06-16', INTERVAL 6 DAY) = '2014-06-10' then worked else 0 end) as '3'
        ,sum(case when DATE_SUB('2014-06-09', INTERVAL 6 DAY) = '2014-06-03' then worked else 0 end) as '4'
        ,sum(case when DATE_SUB('2014-06-02', INTERVAL 6 DAY) = '2014-05-27' then worked else 0 end) as '5'
        ,sum(case when DATE_SUB('2014-05-26', INTERVAL 6 DAY) = '2014-05-20' then worked else 0 end) as '6'
        ,sum(worked) as TotalHours
     from tbl_req_task_map m join tbl_project p on m.project_id=p.project_id
     join tbl_user u on p.project_manager=u.user_id
     join tbl_user a on p.lead_developer=a.user_id
     join tbl_user b on p.lead_qa=b.user_id where m.actual_start='2014-06-30'
     group by p.project_id,u.first_name,a.first_name,b.first_name order by p.project_name;

in the column 1 i want the sum of worked hours between 2014-06-30 and 2014-06-24 and like that in column 2 to column 6 i want the same result but i am not getting between dates.


Viewing all articles
Browse latest Browse all 1350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>