SELECT 'yields'::character(10) AS result_type,
st_y(st_centroid(sites.geometry)) AS lat,
st_x(st_centroid(sites.geometry)) AS lon,
species.id AS species_id,
citations.year AS citation_year,
treatments.name AS treatment,
date_part('month'::text, yields.date) AS month,
date_part('year'::text, yields.date) AS year,
variables.description AS trait_description,
LEFT JOIN sites ON ((yields.site_id = sites.id)))
LEFT JOIN species ON ((yields.specie_id = species.id)))
LEFT JOIN citations ON ((yields.citation_id = citations.id)))
LEFT JOIN treatments ON ((yields.treatment_id = treatments.id)))
LEFT JOIN variables ON (((variables.name)::text = 'Ayield'::text)))
LEFT JOIN users ON ((yields.user_id = users.id)));