Report: Distance between death place and the place burried (in Km)

From TNG_Wiki
Jump to navigation Jump to search

Description: Distance between death place and the place burried (in Km)


Copy and paste the text between the lines into the reports section below "OR Leave Display, Criteria and Sort fields blank and enter direct SQL SELECT statement here:" and give it the title you think is appropriate


SELECT personID, lastname, firstname, deathdate, deathplace, burialdate, burialplace, p.gedcom, 
ROUND(6370*ACOS(SIN(RADIANS(deathcoords.latitude))*SIN(RADIANS(burialcoords.latitude))
+COS(RADIANS(deathcoords.latitude))*COS(RADIANS(burialcoords.latitude))
COS(RADIANS(burialcoords.longitude-deathcoords.longitude))),1) AS Distance FROM tng_people 
AS p LEFT JOIN tng_places AS deathcoords ON (p.deathplace=deathcoords.place 
AND p.gedcom=deathcoords.gedcom) LEFT JOIN tng_places AS burialcoords 
ON (p.burialplace=burialcoords.place AND p.gedcom=burialcoords.gedcom) WHERE deathplace<>burialplace 
AND deathplace<>"" AND burialplace<>"" AND deathcoords.latitude<>"" AND deathcoords.longitude<>"" 
and burialcoords.latitude<>"" AND burialcoords.longitude<>"" 
ORDER BY Distance DESC, lastname, firstname, birthdatetr