Querying the db

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

Querying the db

Postby kukimus » Mon Jun 22, 2009 4:41 am

hello

im trying to query the db.. just for a simple test for now..

here is my code :

###################################################
SELECT
SUM(
(SUM(flg_f_open)) / (SUM(flg_f_open_opp)))



FROM player, holdem_hand_player_detail


WHERE

player_name_search='crazyyandre'
#####################################################

But i get errors.. and i whas wondering what am i doing wrong

regards
k.
kukimus
 
Posts: 18
Joined: Mon Mar 31, 2008 3:20 pm

Re: Querying the db

Postby kukimus » Mon Jun 22, 2009 4:56 am

i need to sum up all the times he bet divided by all the times he had the chanse to bet..

and im a noob so if anybody care to give me a hint it would be great

regards
k.
kukimus
 
Posts: 18
Joined: Mon Mar 31, 2008 3:20 pm

Re: Querying the db

Postby kraada » Mon Jun 22, 2009 9:11 am

PT3 has this stat built in already it's called "Bet Flop".
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: Querying the db

Postby kukimus » Mon Jun 22, 2009 1:24 pm

i now
kukimus
 
Posts: 18
Joined: Mon Mar 31, 2008 3:20 pm

Re: Querying the db

Postby kraada » Mon Jun 22, 2009 3:05 pm

You could pull a more simple version of the stat out by looking in the holdem_cache table, but the actual query to calculate the data is quite a bit more complicated.
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: Querying the db

Postby kukimus » Mon Jun 22, 2009 3:56 pm

im getting this why ?

ERROR: function if(boolean, integer, integer) does not exist
LINE 5: sum(if(flg_f_open,1,0))
kukimus
 
Posts: 18
Joined: Mon Mar 31, 2008 3:20 pm

Re: Querying the db

Postby kraada » Mon Jun 22, 2009 5:18 pm

The if() function isn't a part of PostgreSQL; PT3 has it's own if() wrappers. If you're doing that in a column definition, you want to use []s not ()s, also.
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY


Return to Custom Stats, Reports, and SQL [Read Only]

Who is online

Users browsing this forum: No registered users and 2 guests