SQL Saved search Duplicate ID: Difference between revisions

From IMSMA Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 11: Line 11:
HAVING
HAVING
Count(accident.accident_guid) >  '1'
Count(accident.accident_guid) >  '1'
ORDER BY
accident.accident_localid ASC
</pre>
</pre>
'''Hazard ID'''
'''Hazard ID'''
Line 23: Line 25:
HAVING
HAVING
Count(hazard.hazard_guid) >  '1'
Count(hazard.hazard_guid) >  '1'
ORDER BY
hazard.hazard_localid ASC
</pre>
</pre>
'''HazRed ID'''
'''HazRed ID'''
Line 35: Line 39:
HAVING
HAVING
Count(hazreduc.hazreduc_guid) >  '1'
Count(hazreduc.hazreduc_guid) >  '1'
ORDER BY
hazreduc.hazreduc_localid ASC
</pre>
</pre>
'''Location ID'''
'''Location ID'''
Line 47: Line 53:
HAVING
HAVING
Count(location.location_guid) >  '1'
Count(location.location_guid) >  '1'
ORDER BY
location.location_localid ASC
</pre>
</pre>
'''MRE ID'''
'''MRE ID'''
<pre>
<pre>
 
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
</pre>
'''QA'''
<pre>
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
</pre>
</pre>
[[Category:NoPublic]]
[[Category:NoPublic]]
[[Category:SQL Queries]]
[[Category:SQL Queries]]

Revision as of 06:16, 13 February 2014

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