Maintenance - Pooled Places with no Events
Purpose
This article shows you how you can create an Admin Report that lists all pooled places not linked to any event.
NOTE this report is only if you have multiple trees and share or pool the Places between trees.
If you only have one tree you should use the Maintenance - Pooled Places with no Events
Creating the Report
- In Admin/Reports select the 'Add New' tab.
- Enter a Report Name and Description:
- Select the 'No' radio button against 'Active' (this ensures the report is viewable only by the system administrator).
- Copy the SQL code listed below and paste in the last text box (above the 'Save Report' button).
- Save the Report.
SQL Code
SELECT id, gedcom, concat('<a
href=admin_places.php?tree=',gedcom,'&searchstring=',REPLACE(place,'
','%20'),'&exactmatch=yes&findplace=1&newsearch=1>',place,'</a>') as place,
longitude, latitude, notes
FROM tng_places
WHERE place
IN
( SELECT pl.place FROM tng_places AS pl
LEFT JOIN
(
SELECT birthplace AS place FROM tng_people
UNION
SELECT altbirthplace FROM tng_people
UNION
SELECT baptplace FROM tng_people
UNION
SELECT deathplace FROM tng_people
UNION
SELECT burialplace FROM tng_people
UNION
SELECT marrplace FROM tng_families
UNION
SELECT divplace FROM tng_families
UNION
SELECT eventplace FROM tng_events
UNION
SELECT place FROM tng_cemeteries
UNION
select personID FROM tng_medialinks
WHERE linktype = "L"
) AS p
USING ( place )
WHERE isnull( p.place ) )
Note that the following was added after the initial posting to detect Places in the Cemeteries table
UNION
SELECT place FROM tng_cemeteries
Note also that the following was added to the SQL to also exclude places to which Media record is linked
UNION
select personID FROM tng_medialinks
WHERE linktype = "L"
Viewing and Using the Report
After saving the report changes, click the 'Test' button to run the report from the Admin screen. The resulting report should look like this:
Click on the link in the returned list to open the Place in another window or tab, where you can then verify that no events are associated with the place.
The verify will confirm that no Events are linked to this Place, but since the report does not check for Media linked to the place, it is possible that a Media record is linked to the place as shown below. In which case you will need to relink that Media record before deleting the Place record.
You can then click the Delete icon to delete the place from your database.
Related Links
Maintenance - Places with no maps
Maintenance - Places with no Events
Maintenance - Pooled Places with no Events
Maintenance - Places with identical geocodes
Maintenance - Places - Zoom & Place Levels
Acknowledgments
- Original SQL - Luke Weerts
- Pooled Places SQL - Mark Wonson
- See TNG Forum: https://tng.community/index.php?/forums/topic/3093-not-used-placenames-report/&tab=comments#comment-14401 for a variety of 'tweaks' to the original SQL and that provided here.