Hello,
select Curr.Branch, Curr.AcctType,(Curr.ABal-Prev.ABal) Change
FROM
(
select Account.AcctType ATID, AcctDesc.AcctType, B.Branch, sum(AcctBalance) ABal
from Savings1 Account
left join Branches B
ON Account.BranchID=B.BranchID
left join (select FDD_FIELD_VALUE AcctTypeID, FDD_DESCR_32 AcctType
FROM MiserFieldXRef.dbo.FieldDescription Mise
where FDD_master_field like ‘%s-acct-type%’) AcctDesc
ON Account.AcctType=AcctDesc.AcctTypeID
where [Status]<3
group by Account.AcctType, AcctDesc.AcctType, B.Branch
) Curr
join
(
select Account.AcctType ATID, AcctDesc.AcctType, B.Branch, sum(AcctBalance) ABal
from Savings2 Account
left join Branches B
ON Account.BranchID=B.BranchID
left join (select FDD_FIELD_VALUE AcctTypeID, FDD_DESCR_32 AcctType
FROM MiserFieldXRef.dbo.FieldDescription Mise
where FDD_master_field like ‘%s-acct-type%’) AcctDesc
ON Account.AcctType=AcctDesc.AcctTypeID
where [Status]<3
group by Account.AcctType, AcctDesc.AcctType, B.Branch
) Prev
ON Curr.Branch=Prev.Branch and Curr.ATID=Prev.ATID
order by Curr.Branch, Curr.AcctType
The query above displays this result set
Branch AcctType Change ($)
Georgia Personal Checking 2154789
Georgia Savings 2455555
Georgia Money Market 124545
Florida Personal Checking 132323
Florida Savings 458744
Florida Money Market 2547888
Florida 6-8mnts CD 12455446
I need the results of the query above to create a report in SSRS that looks like what I have below.
Account Type Georgia Florida
Personal Checking 2154789 132323
Savings 2455555 458744
Money Market 124545 2547888
6-8mnts CD 12455446
Any ideas on how I can reformat the query given to me from the format above to the format below? All suggestions welcome, I am new to writing queries and SSRS in general.