SQL Saved search No links
These queries finds records that do not have links which might not be a data quality issue depending on the business rules in your country. They are added to V6.0 as Saved searches with a syntax that works as Saved search
Accidents without link to Victim
SELECT DISTINCT accident_localid FROM accident WHERE accident.accident_guid NOT IN ( SELECT DISTINCT accident.accident_guid FROM link Inner Join accident ON accident.accident_guid = link.from_guid WHERE link.to_link_type = 'Victim') ORDER BY accident_localid
Victims without link to Accident
SELECT DISTINCT victim_localid FROM victim WHERE victim.victim_guid NOT IN ( SELECT DISTINCT victim.victim_guid FROM link Inner Join victim ON victim.victim_guid = link.from_guid WHERE link.to_link_type = 'Accident') ORDER BY victim_localid
Hazards without links This query needs to be adopted to the business rules of the country e.g. all Closed or all CHA should have links
SELECT DISTINCT hazard_localid FROM hazard Left Join link ON hazard.hazard_guid = link.from_guid WHERE link.from_guid IS NULL ORDER BY hazard_localid