-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcs.sql
More file actions
26 lines (26 loc) · 687 Bytes
/
cs.sql
File metadata and controls
26 lines (26 loc) · 687 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
SELECT
c.customer_id,
c.first_name,
c.last_name,
c.email,
a.account_id,
a.account_type,
a.account_number,
a.status AS account_status,
a.balance,
a.currency AS account_currency,
t.transaction_id,
t.amount AS transaction_amount,
t.currency AS transaction_currency,
t.description AS transaction_description,
t.posted_timestamp,
s.statement_id,
s.period_start,
s.period_end,
s.statement_url
FROM customers c
LEFT JOIN accounts a ON a.customer_id = c.customer_id
LEFT JOIN transactions t ON t.account_id = a.account_id
LEFT JOIN statements s ON s.account_id = a.account_id
WHERE c.customer_id = 1
ORDER BY a.account_id, t.transaction_id, s.statement_id;