select 
m.monetary_component_type as type,
i.${productNameCol} as name,
i.digital_order_item_id as order_id,
i.order_date as date,
-sum(m.transaction_amount) as amount
from ${databaseName}.${digOrdItems} i
inner join ${databaseName}.${digOrdReturnsMonetary} m on m.digital_order_item_id = i.digital_order_item_id
group by
i.${productNameCol},
i.digital_order_item_id,
i.order_date,
m.monetary_component_type

