Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL How to?
Message
From
10/01/2007 15:14:33
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
SQL How to?
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01184347
Message ID:
01184347
Views:
56
How can I combine the following into one SQL statement? The problem I am having is the majority of the data is coming from one table, but the criteria for each field is different.
SELECT SUM(nloan_amount) as Total_Amt_CAP_Loans FROM loan.dbf WHERE UPPER(cstatus) = "ENROLLED" OR UPPER(cstatus) = "LOSS" OR UPPER(cstatus) = "PIF"

SELECT SUM(nloan_amount) as Total_Amt_Enrolled_Loans FROM loan.dbf WHERE UPPER(cstatus) = "ENROLLED"

SELECT SUM(nstate_reserve_payment) as nBDC_Reserve FROM loan.dbf WHERE UPPER(cstatus) = "ENROLLED" OR UPPER(cstatus) = "LOSS" OR UPPER(cstatus) = "PIF"

SELECT SUM(nborrower_reserve_payment) + SUM(nlender_reserve_payment) as nBank_Borrower_Reserve FROM loan.dbf WHERE UPPER(cstatus) = "ENROLLED" OR UPPER(cstatus) = "LOSS" OR UPPER(cstatus) = "PIF"

SELECT SUM(ytotal_claim_amount) as nClaims_Paid FROM claims.dbf
Next
Reply
Map
View

Click here to load this message in the networking platform