I have developed two separate queries. Quert I provides an open status listing for a particular technician:
SELECT ti.FIRST_NAME 'Technician', DATE_FORMAT(FROM_UNIXTIME(wo.CREATEDTIME /1000) ,'%d-%m-%Y %k:%i') "Created Time", aau.FIRST_NAME 'Requester',wo.WORKORDERID 'Request ID',wo.TITLE 'Subject', std.STATUSNAME 'Request Status' FROM WorkOrder_Threaded wot INNER JOIN WorkOrder wo ON wot.WORKORDERID=wo.WORKORDERID LEFT JOIN SDUser sdu ON wo.REQUESTERID=sdu.USERID LEFT JOIN AaaUser aau ON sdu.USERID=aau.USER_ID LEFT JOIN WorkOrderStates wos ON wo.WORKORDERID=wos.WORKORDERID LEFT JOIN SDUser td ON wos.OWNERID=td.USERID LEFT JOIN AaaUser ti ON td.USERID=ti.USER_ID LEFT JOIN StatusDefinition std ON wos.STATUSID=std.STATUSID WHERE (( ti.FIRST_NAME = 'Test,User') AND (((((( std.STATUSNAME LIKE '%Follow-Up%') OR (std.STATUSNAME LIKE '%MAINTENANCE%')) OR (std.STATUSNAME LIKE '%ONHOLD%')) OR (std.STATUSNAME LIKE '%OPEN%')) OR (std.STATUSNAME LIKE '%WAITING%')) OR (std.STATUSNAME LIKE '%NONE%'))) AND wot.THD_WOID=wot.WORKORDERID ORDER BY 1
While Query II provides last note information on open tasks:
select no.workorderid Request_id, aau.first_name Technician,DATE_FORMAT(FROM_UNIXTIME(notesdate/1000) ,'%d-%m-%Y %k:%i') "latest Notes_date", no.notestext Notes
from notes no
join aaauser aau on no.userid = aau.user_id
left join workorderstates wos
on no.workorderid=wos.workorderid
where notesid in (select notesid from notes) and wos.statusid in (select statusid from statusdefinition where statusname like 'open');
I have been trying to rewrite a new query without success!!! I've been trying to incorporate both of these queries so that I could have a complete open status listing for a particular technician with lastest notes on those open tasks. Or I'd take any note information. Could someone assist with a query that would meet my needs??
THANKS!!!