Skip to content

Instantly share code, notes, and snippets.

@FlicAnderson
Created June 5, 2015 15:27
Show Gist options
  • Save FlicAnderson/2cf91f91059d5a2bcc17 to your computer and use it in GitHub Desktop.
Save FlicAnderson/2cf91f91059d5a2bcc17 to your computer and use it in GitHub Desktop.
Pulls out determined names and also the accepted one if there's synonymy involved.
SELECT Herb.[Collector Number], Lnam.[Full Name], LnSy.[Full Name] AS accepted, Geography.fullName, Team.Name
FROM (((((Determinations AS Dets RIGHT JOIN [Herbarium specimens] AS Herb ON Dets.[specimen key] = Herb.id) LEFT JOIN [Latin Names] AS Lnam ON Dets.[latin name key] = Lnam.id) LEFT JOIN [Synonyms tree] AS Synm ON Lnam.id = Synm.member) LEFT JOIN [Latin Names] AS LnSy ON Synm.[member of] = LnSy.id) LEFT JOIN Geography ON Herb.Locality = Geography.ID) LEFT JOIN Teams AS Team ON Herb.[Collector Key] = Team.id
WHERE ((Dets.Current)=True) AND ((LnSy.[Synonym of]) Is Null)
ORDER BY Herb.[Collector Number];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment