string(502) "SELECT DISTINCT species.*,
media.Species_ID AS 'has_media'
FROM Maryland_Species species
LEFT JOIN (
SELECT DISTINCT Species_ID
FROM Media
WHERE NeedsReview = 0 AND Photographer_ID = :user
) media ON species.Species_ID = media.Species_ID
JOIN (
SELECT DISTINCT Species_ID
FROM MDB_Records
WHERE IsDisplayed = 1 AND Person_ID = :user
) records ON species.Species_ID = records.Species_ID
WHERE species.IsDisplayed = 1
ORDER BY Kingdom, Class, OrderName, Family, Genus, Species"