The following query will allow you to replicate what you see in an element working list. The Full ID and Geolevel columns are calculated values that are useful for sorting. This query does not (at present--more work underway) concatenate the element_subnational_id onto the Full ID field. However, it will still allow you to sort and group the EGT, ENT, and ESTs for the same elements, even if they have a different scientific name.
This query is actually three queries put together: one for EGTs, one for ENTs, and one for ESTs. To use it for a working list that contains all three geographic levels of element tracking records, you must insert the name of your working list 3 times where indicated. If your working list contains only one type of element tracking record (e.g., only ESTs) you may run only that portion of the query. (query also attached)
SELECT
eg.element_global_id as ID,
eg.element_global_id as Full_ID,
hcu.concatenated_cd as Higher_Tax_Class_Code,
sn.scientific_name as Scientific_Name,
eg.g_primary_common_name as Common_Name,
eg.g_rank as Rank,
'Global' as Geolevel, '' as Nation, '' as Subnation,
dcs.classification_status_desc as Classification_Status,
decode(eg.inactive_ind, 'Y', 'Yes',
'N', '') Inactive
FROM
element_global eg,
higher_class_unit hcu,
scientific_name sn,
d_classification_status dcs
WHERE
eg.higher_class_unit_id = hcu.higher_class_unit_id (+)
and eg.gname_id = sn.scientific_name_id
and eg.d_classification_status_id = dcs.d_classification_status_id
and eg.element_global_id in
(select wled.data_id
from working_list_element_data wled, working_list wl
where wled.working_list_id = wl.working_list_id
and wl.working_list_name = '$$$$')/****REPLACE $$$$ with WORKING LIST NAME****/
UNION
SELECT
en.element_national_id as ID,
to_number(eg.element_global_id||'.'||en.element_national_id) as Full_ID,
hcu.concatenated_cd as Higher_Classif_Code,
sn.scientific_name as Scientific_Name,
en.n_primary_common_name as Common_Name,
en.n_rank as Rank,
'National' as Geolevel,
nation.iso_nation_cd as Nation, '' as Subnation,
dcs.classification_status_desc as Classification_Status,
decode(eg.inactive_ind, 'Y', 'Yes',
'N', '') Inactive
FROM
element_global eg,
element_national en,
higher_class_unit hcu,
scientific_name sn,
d_classification_status dcs,
nation
WHERE
en.element_global_id = eg.element_global_id
and eg.higher_class_unit_id = hcu.higher_class_unit_id (+)
and en.nname_id = sn.scientific_name_id
and eg.d_classification_status_id = dcs.d_classification_status_id
and en.nation_id = nation.nation_id
and en.element_national_id in
(select wled.data_id
from working_list_element_data wled, working_list wl
where wled.working_list_id = wl.working_list_id
and wl.working_list_name = '$$$$')/****REPLACE $$$$ with WORKING LIST NAME****/
UNION
SELECT
es.element_subnational_id as ID,
to_number(eg.element_global_id||'.'||en.element_national_id) as Full_ID,
hcu.concatenated_cd as Higher_Tax_Class_Code,
sn.scientific_name as Scientific_Name,
es.s_primary_common_name as Common_Name,
es.s_rank as Rank,
'Subnational' as Geolevel,
nation.iso_nation_cd as Nation,
subnation.subnation_code as Subnation,
dcs.classification_status_desc as Classification_Status,
decode(eg.inactive_ind, 'Y', 'Yes',
'N', '') Inactive
FROM
element_global eg,
element_national en,
element_subnational es,
higher_class_unit hcu,
scientific_name sn,
d_classification_status dcs,
nation,
subnation
WHERE
es.element_national_id = en.element_national_id
and en.element_global_id = eg.element_global_id
and eg.higher_class_unit_id = hcu.higher_class_unit_id (+)
and es.sname_id = sn.scientific_name_id
and eg.d_classification_status_id = dcs.d_classification_status_id
and nation.nation_id = subnation.nation_id
and es.subnation_id = subnation.subnation_id
and es.element_subnational_id in
(select wled.data_id
from working_list_element_data wled, working_list wl
where wled.working_list_id = wl.working_list_id
and wl.working_list_name = '$$$$')/****REPLACE $$$$ with WORKING LIST NAME****/