select distinct
nvl(a.label, 'No Label Available') as label,
nvl(a.project_name,'No Label Available') as project_name,
attribute_value,
count(distinct tx_id) as tx_count,
count(tx_id) as event_count
from terra.core.fact_msg_attributes, terra.core.dim_address_labels a
where attribute_key = '_contract_address'
and attribute_value = address (+)
group by 1,2,3
order by event_count desc