[Solved] Work around for Median in SQL Query

Discuss the database features
Post Reply
enjoying28
Posts: 5
Joined: Thu Dec 16, 2010 12:06 am

[Solved] Work around for Median in SQL Query

Post by enjoying28 »

Hay I need some help. I have a 42k record table that I need the median price for a grouped set of records. Grouped by year then month and then the median (not the avg or mean) of them. I know base does not have a function for median does anyone have code for a macro or something that i could use as a work around?

Code: Select all

SELECT Median( "Price" ) AS "Price", "LstArea" AS "LstArea", YEAR( "CloseDate" ) AS "Year", MONTH( "CloseDate" ) AS "Month" FROM "main" "main" WHERE ( "LstStatus" = 'Sold' ) GROUP BY "LstArea", "Year", "Month"
thanks for any info.
Last edited by TheGurkha on Tue Dec 21, 2010 11:53 pm, edited 2 times in total.
Reason: Tagged Solved, TheGurkha.
OpenOffice 3.21 on Windows 7
enjoying28
Posts: 5
Joined: Thu Dec 16, 2010 12:06 am

Re: Work around for Median in SQL Query

Post by enjoying28 »

OpenOffice 3.21 on Windows 7
Post Reply