-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExportSummary.sql
More file actions
22 lines (22 loc) · 797 Bytes
/
ExportSummary.sql
File metadata and controls
22 lines (22 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
select
case
when Description like 'AMAZON MKTPL%' then 'AMAZON MKTPL'
when Description like 'Amazon Digit%' then 'Amazon Digit'
when lower(Description) like 'amazon.com*% pos' then 'Amazon POS'
when Description like 'APPLE%COM%BILL%POS' then 'APPLE.COM/BILL'
when Description like 'Audible% POS' then 'Audible'
when Description like '%Roblox%' then 'Roblox'
when Description like 'Kindle Svcs%' then 'Kindle Svcs'
else Description
end Description
,round(sum("Amount Debit"), 2) Debit
,round(sum("Amount Credit"), 2) Credit
,count(*) Count
,round((sum(coalesce("Amount Credit",0))+sum(coalesce("Amount Debit",0)))/count(*), 2) Average
,min("Amount Debit") MinDebit
,max("Amount Debit") MaxDebit
,min(Date) MinDate
,max(Date) MaxDate
from download.CSV
group by 1
order by 9