Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 YTD Median Price - including history

Author  Topic 

offspring22
Starting Member

38 Posts

Posted - 2014-08-27 : 16:24:00
Hello,

We have a DB full of real estate sold data going back to 1990, and it includes the following fields:

SOLDDATE|SOLDPRICE|COMMUNITY

I need to use it to fill a YTDMEDIAN table with the following fields:

SOLDYEAR|SOLDMONTH|COMMUNITY|MEDIANSOLDPRICE

I need to calculate the history going back to 1990, and having it grouped by where the community is located in as well. Each month would be a year to date for the month. I can't think of any way to automate this unfortunately.... I've been able to figure out grouping monthly totals, but the YTD (and median) is throwing me for a loop. Any tips or suggestions?

Thanks!

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-08-27 : 20:09:24
post some sample data and expected output
Go to Top of Page
   

- Advertisement -