SQL Answers
SQL Answers
display the service providers info for loans that had no GFee
change.
select sp.*
from #ServiceProvider as sp inner join
#BorrowerInfo as BI on sp.ProviderID=BI.ProviderID inner
join
#LoanInfo1 as LI on LI.BorrowerID=BI.BorrID inner join
#TestResult_After as TA on LI.LoanNum = TA.LoanNum inner
join
#TestResult_Before as TB on LI.LoanNum= tb.LoanNum
where
TA.GFee=TB.GFee
---------------------------------------------------------------display loan counts of results that had changes on eligibility
and gfee; group by Eligibility.
select TA.Eligibility,
COUNT(ta.LoanNum)LoanCount
from
#TestResult_After as TA inner join
#TestResult_Before as TB on TA.LoanNum=tb.LoanNum
where
TA.Eligibility<>TB.Eligibility and TA.GFee<>TB.GFee
Group by TA.Eligibility
---------------------------------------------------------display matching (no change) counts, mismatching (with change)
counts, and total loan counts of all test result comparisons;
group by Eligibility.
Select count(LoanNum) LC,Eligibility
From
(
select TA.* from
#TestResults_Before TB inner join
#Test Results_After TA on Tb.LoanNum=TA.LoanNum
Where
Tb.Eligibility<>TA.Eligibility and Tb.Gfee<>TA.GFEE
)Tb
Group by Eligibility