Becky Edwards
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_SNAPSH OT 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
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
from clarity.dbo.HSP_HAR_SNAPSH
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
Right it's the alias and is called with ca.column
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Becky, do you still need help with this question?
ASKER
I appreciate this help. I needed both comments to truly understand so I gave both points. They were equally good. Thank you!