Link to home
Start Free TrialLog in
Avatar of Becky Edwards
Becky EdwardsFlag for United States of America

asked on

Decipher Sequel Query from MS SQL

Can someone tell me what this is doing?  Does the ca at the end mean that is the name of the stuff in ( )?  And what is the little b for?

 left outer join (
            select b.HSP_ACCOUNT_ID
            ,MAX(b.BALANCE) as BALANCE
            from (select hs.HSP_ACCOUNT_ID
                  ,BALANCE = hs.TOT_CHGS+hs.TOT_PMTS+hs.TOT_ADJS
                  from clarity.dbo.HSP_HAR_SNAPSHOT hs
                  where hs.COLL_AGENCY_ASSN_DT is not null and
                  hs.COLL_AGENCY_ASSN_DT >= @StartDate and
                  hs.COLL_AGENCY_ASSN_DT < DATEADD(d,1,@EndDate)) b
            group by b.HSP_ACCOUNT_ID
      )ca
            on HSP_ACCOUNT.HSP_ACCOUNT_ID = ca.HSP_ACCOUNT_ID
Avatar of Thomas Wheeler
Thomas Wheeler

Right it's the alias and is called with ca.column
SOLUTION
Avatar of Brian Crowe
Brian Crowe
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Becky, do you still need help with this question?
Avatar of Becky Edwards

ASKER

I appreciate this help.  I needed both comments to truly understand so I gave both points.  They were equally good.  Thank you!