Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 979 Bytes

075_applepay_volume.md

File metadata and controls

39 lines (27 loc) · 979 Bytes

SQL Everyday #075

ApplePay Volume

Site: DataLemur
Difficulty per Site: Easy

Problem

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

-- 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
;

Site Solution

-- DataLemur Solution 
-- Site solution essentially the same.

Notes

TODO

Go to Table of Contents
Go to Overview