select
sum(o1.O_TOTALPRICE+1), -- CC
SUM(CUSTOMER_1.C_ACCTBAL)
from FROM
TPCH.ORDERS as o1
INNER JOIN TPCH.CUSTOMER as CUSTOMER
ON o1.O_CUSTKEY=CUSTOMER.C_CUSTKEY
INNER JOIN TPCH.CUSTOMER as CUSTOMER_1
ON o1.O_ORDERKEY=CUSTOMER_1.C_CUSTKEY
inner join tpch.ORDERS o2
on o1.O_ORDERKEY = o2.O_ORDERKEY
where
CUSTOMER_1.C_ACCTBAL> 5000 -- derived dim
group by o1.O_ORDERDATE