SQL Saved search Task
These queries are about Tasks. They are added to V6.0 as Saved searches with a syntax that works as Saved search
Hazards not included in any Task This query would need to be adopted together with Ops e.g. all CHA in flat areas should have been tasked
SELECT hazard_localid FROM hazard WHERE hazard.hazard_guid NOT IN (SELECT task_has_objective.hazard_guid FROM task_has_objective) ORDER BY hazard_localid
Hazard included in more than one Task which could be OK depending on the business rules
SELECT hazard.hazard_localid, Count(task_has_objective.task_guid) FROM hazard Inner Join task_has_objective ON hazard.hazard_guid = task_has_objective.hazard_guid GROUP BY hazard.hazard_localid HAVING Count(task_has_objective.task_guid) > '1' ORDER BY hazard.hazard_localid ASC
Tasks without Objectives which could be OK depending on the business rules
SELECT task.localid FROM task_has_objective Right Join task ON task.guid = task_has_objective.task_guid where task_has_objective.task_guid IS NULL ORDER BY task.localid