SQL Saved search Different Location

From IMSMA Wiki
Revision as of 08:26, 13 February 2014 by Alnaucler (talk | contribs) (Created page with "These queries finds records where the assigned locations is not the same. They are added to V6.0 as Saved searches with a syntax that works as Saved search <br /> '''Accident ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

These queries finds records where the assigned locations is not the same. They are added to V6.0 as Saved searches with a syntax that works as Saved search
Accident and Victim


Hazard and HazRed

SELECT DISTINCT
hazard_localid 
FROM
hazard
Inner Join link ON hazard.hazard_guid = link.from_guid
Inner Join hazreduc ON link.to_guid = hazreduc.hazreduc_guid
Inner Join location AS HazLoc ON hazard.location_guid = HazLoc.location_guid
Inner Join location AS HazRedLoc ON hazreduc.location_guid = HazRedLoc.location_guid
WHERE
link.from_link_type =  'Hazard'
AND (HazLoc.location_guid <> HazRedLoc.location_guid)
ORDER BY
hazard_localid