Question
SQL/ORACLE select unique customer_number Cust#, account_type Type, Balance Status from wgb_account_type natural join wgb_account where balance > 0 AS Non-Zero Balance union all select unique
SQL/ORACLE
select unique customer_number Cust#, account_type Type, Balance Status from wgb_account_type natural join wgb_account where balance > 0 AS Non-Zero Balance union all select unique customer_number Cust#, account_type Type, Balance Status from wgb_account natural join wgb_transaction where transaction_amount > 0 order by 1,2;
The following is the result of the above query statement, however, in the ststus column I want to display "Has Transaction" or "Non-zero Balance", as shown in the second table.
CUST# TYPE STATUS ------- ---------- ---------- 1112401 1 11000 1112401 1 11000 1112401 2 5000 1112401 2 5000 1113004 3 2000 1113004 3 2000 1113501 2 3000 1113501 2 3000
8 rows selected.
CUST# TYPE STATUS ------- ---------- ---------- 1112401 1 Has Transaction 1112401 1 Non-zero Balance 1112401 2 Has Transaction 1112401 2 Non-Zero Balance 1113004 3 Has Transaction 1113004 3 Non-Zero Balance 1113501 2 Has Transaction 1113501 2 Non-Zero Balance
8 rows selected.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started