SQL Saved search Duplicate ID

From IMSMA Wiki
Revision as of 06:16, 13 February 2014 by Alnaucler (talk | contribs)
Jump to navigation Jump to search

These queries finds duplicates on ID. They are added to V6.0 as Saved searches with a syntax that works as Saved search
Accident ID

SELECT
accident.accident_localid,
Count(accident.accident_guid)
FROM
accident
GROUP BY
accident.accident_localid
HAVING
Count(accident.accident_guid) >  '1'
ORDER BY
accident.accident_localid ASC

Hazard ID

SELECT
hazard.hazard_localid,
Count(hazard.hazard_guid)
FROM
hazard
GROUP BY
hazard.hazard_localid
HAVING
Count(hazard.hazard_guid) >  '1'
ORDER BY
hazard.hazard_localid ASC

HazRed ID

SELECT
hazreduc.hazreduc_localid,
Count(hazreduc.hazreduc_guid)
FROM
hazreduc
GROUP BY
hazreduc.hazreduc_localid
HAVING
Count(hazreduc.hazreduc_guid) >  '1'
ORDER BY
hazreduc.hazreduc_localid ASC

Location ID

SELECT
location.location_localid,
Count(location.location_guid)
FROM
location
GROUP BY
location.location_localid
HAVING
Count(location.location_guid) >  '1'
ORDER BY
location.location_localid ASC

MRE ID

SELECT
mre.mre_localid,
Count(mre.mre_guid)
FROM
mre
GROUP BY
mre.mre_localid
HAVING
Count(mre.mre_guid) >  '1'
ORDER BY
mre.mre_localid ASC

QA

SELECT
qa.qa_localid,
Count(qa.qa_guid)
FROM
qa
GROUP BY
qa.qa_localid
HAVING
Count(qa.qa_guid) >  '1'
ORDER BY
qa.qa_localid ASC