sql - Trying to combine select sum and count statemenents into one (oracle db) -


i need write 1 statement gets sum of total number of customers , sum of accounts. able each individually can not them 1 statement. error message mean, should from go?

this statement loan total

sql> select sum(amount) "total"      loan, borrower      borrower.loan_number = loan.loan_number; 

this statement number of customers

   sql> select count(*)         customer; 

i have combined them error message can see.

> sql> select 2  (select count(*) "total customers" customer) 3  (select sum(amount) "total loan values" 4  borrower, loan  5  borrower.loan_number = loan.number); (select sum(amount) "total loan values"  *  error @ line 3:  ora-00923: keyword not found expected 

since query customer returns single line, cross join other question:

select     sum(amount) total, cnt       loan join       borrower on borrower.loan_number = loan.loan_number; cross join (select count(*) cnt                customer)  

Comments