Forum for users that want to write their own custom queries against the PT database either via the Structured Query Language (SQL) or using the PT3 custom stats/reports interface.
Moderator: Moderators
by ElT007 » Fri Jun 05, 2009 3:39 pm
I am unable to create a column for median finish because I do not know the proper syntax. I have tried median(tourney_holdem_results.val_finish) and med(tourney_holdem_results.val_finish)
-
ElT007
-
- Posts: 260
- Joined: Fri Jun 05, 2009 3:04 pm
by WhiteRider » Fri Jun 05, 2009 4:35 pm
I'll see if I can find out for you..
-
WhiteRider
- Moderator
-
- Posts: 54025
- Joined: Sat Jan 19, 2008 7:06 pm
- Location: UK
by WhiteRider » Mon Jun 08, 2009 4:49 am
Median is not a supported function. You would need to create an aggregate median function for that to work.
This isn't straightforward so you'll need to do a bit of reading..
http://www.joeconway.com/plr/doc/plr-aggregate-funcs.html- Code: Select all
CREATE OR REPLACE FUNCTION r_median(_float8) RETURNS float AS '
median(arg1)
' LANGUAGE 'plr';
CREATE AGGREGATE median (
sfunc = plr_array_accum,
basetype = float8,
stype = _float8,
finalfunc = r_median
);
Once the above function is defined then you can use the SQL syntax they you are currently attempting to use.
-
WhiteRider
- Moderator
-
- Posts: 54025
- Joined: Sat Jan 19, 2008 7:06 pm
- Location: UK
by ElT007 » Mon Jun 08, 2009 1:15 pm
Would you be willing to do a remote session to set this up for me and investigate the decimal places of the percentile function?
-
ElT007
-
- Posts: 260
- Joined: Fri Jun 05, 2009 3:04 pm
Return to Custom Stats, Reports, and SQL [Read Only]
Users browsing this forum: No registered users and 0 guests