Find multiple variables (multiple conditions) in list – SQL

Starting from the transactions details, you can join the customers table twice (once for account_from and once for account_to) and filter out those that have the same customer_id. The final step is aggregation:

select sum(td.euro_amount) sum_euro_amount
from transaction_details td
inner join customer c1 on c1.account = td.account_from
inner join customer c2 on c2.account = td.account_to
where c1.customer_id <> c2.customer_id

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top