Hi,
I have a report that pulls a whole bunch of data for a trouble ticketing system I have. It basically lists all the work I have done on each ticket (inc obvious code to cleanup fields and formats). I have tried to use a dbr.sum on the two billing fields but absolutely nothing is added up. Any ideas what I am doing wrong? It reports fine, just no totals. Be aware I have only been using SQL for a few weeks so there may be a real stupid ommission on my part...
Thanks
Graham
DROP PROCEDURE IF EXISTS sp_DBR_febburr
$$
CREATE PROCEDUREsp_DBR_febburr
( vStartDate date, vEndDate date, inLogin varchar(30) )
BEGIN select 'dbr.hdr', 5; /* Sets the Year to be a header column */
select 'dbr.sum', 3, 4; /* Calculate sum from Items and Weight column */
select 'dbr.summarytxt', 1, 'Total'; SELECT a.fieldvalue AS 'Work Location', FROM_UNIXTIME(b.dateline, '%d/%m/%Y') AS 'Date',sum(b.timespent) as 'Time Worked (Minutes)',sum(b.timebillable) AS 'Billable', c.TicketID AS 'Ticket Number',e.fullname AS 'AffinIT Staff',d.title AS 'Ticket Status', c.fullname AS 'Raised by',c.email AS 'Email Address',c.subject AS 'Ticket Subject', b.notes AS 'Entry Description'
FROM kayako_suite.swtickettimetrack b, kayako_suite.swtickets c, kayako_suite.swcustomfieldvalues a, kayako_suite.swticketstatus d, kayako_suite.swstaff e, kayako_suite.aff_login f
WHERE b.ticketid = c.ticketid
and c.ownerstaffid = e.staffid
and d.ticketstatusid = c.ticketstatusid
and a.typeid = b.timetrackid
and a.fieldvalue in('Remote','System Work')
and b.dateline between UNIX_TIMESTAMP(vStartDate) and UNIX_TIMESTAMP(vEndDate)
and f.myDBRLogin=inLogin
and c.departmentid = f.departmentID; END
$$