Deleted tickets are showing up in a SQL query
I'm trying to write a query that shows me all tickets that are missing a time entry, so I can make sure the agents are logging their time accurately. My script is:
-
SELECT "Request ID", "Ticket Owner Name", "Created Time","Department Name"
-
FROM "Tickets"
-
LEFT JOIN "Time Entry" ON "Time Entry"."Request" = "Tickets"."ID" LEFT JOIN "Agent" ON "Agent"."ID" = "Time Entry"."Agent"
-
WHERE (MONTH(Tickets."Created Time") = MONTH(Curdate())
AND YEAR("Created Time") = YEAR(CURDATE()))
-
AND "Executed Time" is NULL
However, this report this pulling in deleted tickets and I can't find an identifier that would indicate a ticket has been deleted. Help or thoughts appreciated!