Project - Reporting time spent on tasks

Project - Reporting time spent on tasks

I seen quite a few posts about similar things but I have yet to find one that works flawlessly for me. 

I nicked this one from another post and added "createdtime":

select max(tc.chargeid)"Charge ID",max(au.first_name)"Technician",max(ct.description)"Description",max(pd.title)"Project Title",max(md.title)"Milestone Title",max(td.title)"Task Title",SUM(ct.TIMESPENT)/1000/3600"Timespent",max(ct.TECH_CHARGE)"Tech Charge",max(ct.other_charge)"Other Charge",max(ct.total_charge)"Total Charge",longtodate(max(ct.ts_starttime))"Start Time",longtodate(max(ct.ts_endtime))"End Time" from tasktocharge tc left join chargestable ct on ct.chargeid=tc.chargeid left join taskdetails td on td.taskid=tc.taskid left join aaauser au on au.user_id=ct.technicianid left join tasktoprojects tp on tp.taskid=td.taskid left join projectdetails pd on pd.projectid=tp.projectid left join milestonedetails md on md.milestoneid=tp.milestoneid where ct.CREATEDTIME >= <from_thismonth> AND ct.CREATEDTIME <= <to_thismonth> and td.module='milestone' or td.module='project' 
group by tc.chargeid order by 4,5


But my problem is that the TIMESPENT is empty when I run the report. I assume its not picking up the time from "Time Taken To Resolve". Or is it something else I missed? I need some way to report the time we spend on tasks in Projects. 

We use PGSQL (I think). 

Regards
Conny

                  New to ADSelfService Plus?