all groups > sql server reporting services > september 2007 >
You're in the

sql server reporting services

group:

Need help with query for previous year spend vs. current year spen


Need help with query for previous year spend vs. current year spen Jeff Stroope
9/7/2007 9:00:02 AM
sql server reporting services:
Hi,

I need to come up with a query for some financial statement reports. The
reports require current year $$ vs. previous year $$ by month, quarter and
year. I'm building a stored procedure to produce the necessary dataset for
my reports. So, in the sp, I build two temp tables – one for previous year
and one for current year. How do I bash these tables together in order to
get a previous year $$ column and a current year $$ column by account number
and branch location? I think I have part of the answer – join the two temp
tables on account number and branch location and select all columns giving an
alias to one of the $$ columns for either previous or current year. The
sticky part is, there may be account numbers in current year that don’t exist
in previous year and vice versa. I’d like to put $0.00 in this case where
there was no spend. I tried a full outer join, but I get way too many
records and a lot of duplicate values. Has anyone ever faced this problem
and do you have a solution? I’d like to avoid using cursors if possible
because they seem to degrade performance.
--
Thanks,

RE: Need help with query for previous year spend vs. current year spen Jimbo
9/7/2007 1:14:03 PM
do a "select distinct" to remove duplicates



[quoted text, click to view]
RE: Need help with query for previous year spend vs. current year Jeff Stroope
9/7/2007 1:40:01 PM
Thanks!
--
Thanks,

Jeff


[quoted text, click to view]
AddThis Social Bookmark Button