Query to extract a list of technicians who haven't handled any tickets during a specific time duration (MSSQL & PGSQL)

Query to extract a list of technicians who haven't handled any tickets during a specific time duration (MSSQL & PGSQL)

Tested in builds PGSQL (14300) or MSSQL (14306)

Query:

select distinct  aau.user_id as "Technician User ID" ,
aau.FIRST_NAME as "Technician Name",
ac.emailid as "Technician EmailID"  from aaauser aau   
left join sduser sdu on aau.user_id = sdu.userid  
left join aaausercontactinfo auc on aau.user_id=auc.user_id
left join aaacontactinfo ac on auc.contactinfo_id=ac.contactinfo_id
where aau.user_id in (select userid from portaltechnicians)
and aau.user_id not in (select distinct wo.requesterid from workorder wo where wo.createdtime >= datetolong('2023-04-01 00:00:00') and wo.createdtime <= datetolong('2023-04-31 00:00:00')) and sdu.STATUS = 'Active' and aau.user_id > 1

Note :  Kindly change the highlighted text as per the date requirement.

                  New to ADSelfService Plus?