R
rdcsfd
I'm using the following query to get quarterly results for each bedroom
number. The median function is returning the same number for each bedroom
number in each quarter. Can someone tell me how to get it to provide the
median price by bedroom number?
SELECT DISTINCTROW Sales2.City, Format$([Sales2].[Selling Date],'\Qq yyyy')
AS [Quarter], Sales2.[Property Subtype 1], Sales2.Bedrooms AS [Bedrooms],
Avg(Sales2.[Selling Price]) AS [Average Price],
Format$(CDbl(acbDMedian("[Selling Price]","Sales2","Format$([Selling
Date],'\Qq yyyy') = '" & Format$(Sales2.[Selling Date],'\Qq yyyy') &
"'")),'$#,###') AS [Median Price], Min(Sales2.[Selling Price]) AS [Lowest
Price], Max(Sales2.[Selling Price]) AS [Highest Price], Count(*) AS [# Sold]
FROM Sales2
WHERE Sales2.City = 'Santa Rosa' AND Sales2.[Property Subtype 1] = 'Cond'
GROUP BY Sales2.City, Format$([Sales2].[Selling Date],'\Qq yyyy'),
Sales2.[Property Subtype 1], Sales2.Bedrooms, Year([Sales2].[Selling
Date])*4+DatePart('q',[Sales2].[Selling Date])-1;
Here are the results from the above query:
City Quarter Type Bedrooms Average Median
Santa Rosa Q1 2003 COND 1 $163,666.67 $375,000
Santa Rosa Q1 2003 COND 2 $238,704.17 $375,000
Santa Rosa Q1 2003 COND 3 $292,577.59 $375,000
Santa Rosa Q1 2003 COND 4 $420,000.00 $375,000
Santa Rosa Q1 2004 COND 1 $184,909.09 $425,000
Santa Rosa Q1 2004 COND 2 $272,024.92 $425,000
Santa Rosa Q1 2004 COND 3 $333,270.00 $425,000
Santa Rosa Q1 2004 COND 4 $277,000.00 $425,000
TIA
number. The median function is returning the same number for each bedroom
number in each quarter. Can someone tell me how to get it to provide the
median price by bedroom number?
SELECT DISTINCTROW Sales2.City, Format$([Sales2].[Selling Date],'\Qq yyyy')
AS [Quarter], Sales2.[Property Subtype 1], Sales2.Bedrooms AS [Bedrooms],
Avg(Sales2.[Selling Price]) AS [Average Price],
Format$(CDbl(acbDMedian("[Selling Price]","Sales2","Format$([Selling
Date],'\Qq yyyy') = '" & Format$(Sales2.[Selling Date],'\Qq yyyy') &
"'")),'$#,###') AS [Median Price], Min(Sales2.[Selling Price]) AS [Lowest
Price], Max(Sales2.[Selling Price]) AS [Highest Price], Count(*) AS [# Sold]
FROM Sales2
WHERE Sales2.City = 'Santa Rosa' AND Sales2.[Property Subtype 1] = 'Cond'
GROUP BY Sales2.City, Format$([Sales2].[Selling Date],'\Qq yyyy'),
Sales2.[Property Subtype 1], Sales2.Bedrooms, Year([Sales2].[Selling
Date])*4+DatePart('q',[Sales2].[Selling Date])-1;
Here are the results from the above query:
City Quarter Type Bedrooms Average Median
Santa Rosa Q1 2003 COND 1 $163,666.67 $375,000
Santa Rosa Q1 2003 COND 2 $238,704.17 $375,000
Santa Rosa Q1 2003 COND 3 $292,577.59 $375,000
Santa Rosa Q1 2003 COND 4 $420,000.00 $375,000
Santa Rosa Q1 2004 COND 1 $184,909.09 $425,000
Santa Rosa Q1 2004 COND 2 $272,024.92 $425,000
Santa Rosa Q1 2004 COND 3 $333,270.00 $425,000
Santa Rosa Q1 2004 COND 4 $277,000.00 $425,000
TIA