Hi,
relatively new to SQL. Bear with me, please.
I've written a script that inserts two sets of data into temp tablesand subsequently selects data, via joins, from the two of them to relate data in the following columns:
Set.1
Business Volume | Number of Properties | Office | Avg. Days on Market
MONEY VALUE 1___INT 1______________NAME1________INT 1
MONEY VALUE 2___INT 2______________NAME2________INT 2
...
Here's the thing, I'm looking to have this data display on a yearly basis such that the columns would be:
Set.2
Year | Business Volume | Number of Properties | Office | Avg. Days on Market
2008_ MONEY VALUE 1.0_______INT 1.0________NAME1.0_____INT 1.0
2009_ MONEY VALUE 1.1_______INT 1.1________NAME1.1_____INT 1.1
...
2008_ MONEY VALUE 2.0_______INT 2.0________NAME2.0_____INT 2.0
2009_ MONEY VALUE 2.1_______INT 2.1________NAME2.1_____INT 2.1
...
As of right now Set.1 is an aggregate of what I want, not broken down by year. Set.2 is what I'm after - a year-by-year breakdown of what Set.1 is.
I've been told I can use a Pivot, or possibly Case statements, but pivot examples don't seem to use script with temp tables. Any suggestions? I could include the actual script or other information, if needed.
Thanks.