• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 152
  • Last Modified:

I want to do something like what is on the 4th l line of query

SELECT  max(D.delta) delta_max,
            min(D.delta) delta_low,
            round(avg(D.delta), 4) delta_avg,
            count(D.delta > .5),
            count(*) total
from(
      SELECT C.LPMIMonthlyAmt CM, B.LPMIMonthlyAmt CM2, round((B.LPMIMonthlyAmt- C.LPMIMonthlyAmt),4) as delta
      from cm.dbo.martloaninterfacedetail B join
      cm2.dbo.Account_Loan C
      on        B.LOANACCTNUM = C.AccountNumber
      where B.loanacctnum IN (SELECT A.acct
                                          from dbo.cm_loans A
                                          where A.acct IN (select acct
                                                                  from CMvCM2LoanDetailCompare
                                                                  where score & 131072 = 131072)
                                          and A.live ='1')
)as D
0
donnatronious
Asked:
donnatronious
1 Solution
 
dbbishopCommented:
SUM(CASE D.delta WHEN > .5 THEN 1 ELSE 0 END)

You are summing 1s and 0s
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now