Site: DataLemur
Difficulty per Site: Easy
Visa is analysing its partnership with ApplyPay. Calculate the total transaction volume for each merchant where the transaction was performed via ApplePay.
Output the merchant ID and the total transactions. For merchants with no ApplePay transactions, output their total transaction volume as 0. Display the result in descending order of the transaction volume. [Full Description]
-- Submitted Solution
SELECT
merchant_id
,SUM(CASE WHEN LOWER(payment_method) = 'apple pay' THEN transaction_amount ELSE 0 END) AS total_transaction
FROM transactions
GROUP BY merchant_id
ORDER BY total_transaction DESC
;
-- DataLemur Solution
-- Site solution essentially the same.
TODO
Go to Table of Contents
Go to Overview