Delimlists for adult and immature food habits and phenology
AUTHOR: Jason McNees, NatureServe
SELECT egt.element_global_id,
egt.elcode_bcd,
gname.scientific_name gname,
egt.g_primary_common_name,
DelimList('SELECT d_food_habits.food_habits_desc FROM d_food_habits, animal_cag_food_habits acfh' || ' WHERE
d_food_habits.d_food_habits_id = acfh.d_food_habits_id AND acfh.adult_ind = ''Y'' AND
acfh.element_global_id =' || egt.element_global_id, ', ') adult_food_habits,
DelimList('SELECT d_food_habits.food_habits_desc FROM d_food_habits, animal_cag_food_habits acfh' || ' WHERE
d_food_habits.d_food_habits_id = acfh.d_food_habits_id AND acfh.immature_ind = ''Y'' AND
acfh.element_global_id =' || egt.element_global_id, ', ') immat_food_habits,
DelimList('SELECT d_animal_phenology.animal_phenology_desc FROM d_animal_phenology, animal_cag_phenology acp' || ' WHERE
d_animal_phenology.d_animal_phenology_id = acp.d_animal_phenology_id AND acp.adult_ind = ''Y'' AND
acp.element_global_id =' || egt.element_global_id, ', ') adult_phenology,
DelimList('SELECT d_animal_phenology.animal_phenology_desc FROM d_animal_phenology, animal_cag_phenology acp' || ' WHERE
d_animal_phenology.d_animal_phenology_id = acp.d_animal_phenology_id AND acp.immature_ind = ''Y'' AND
acp.element_global_id =' || egt.element_global_id, ', ') immat_phenology
FROM element_global egt,
scientific_name gname,
animal_cag ac
WHERE egt.gname_id = gname.scientific_name_id
and egt.element_global_id = ac.element_global_id (+)