How to create query to PostgreSQL

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

Re: How to create query to PostgreSQL

Postby TROM » Sat Apr 10, 2010 1:01 pm

Thank you very much!!!

now I see my query works!

But i thik I need a little more help
I want to add specific limit in my query

i have example

Code: Select all
// hands
      "SELECT count(id_hand) as result \
       FROM   holdem_hand_player_statistics as PS, holdem_limit L, player as P \
       WHERE  PS.id_player = P.id_player \
            AND P.player_name = '%SCREENNAME%' \
            AND P.id_site = '%SITEID%' \
            AND L.amt_bb = %BB%"


AND L.amt_bb = %BB% its big blind of the limit
I add for example 1 for 1/2$ fixed limit
But I dont get hands numbers for this limit
number what I get much bigger

for example my total hands number is 8000 but query show 20000
when I delete AND L.amt_bb = 1
query show total hands number for all limts

Where I have error now?
TROM
 
Posts: 57
Joined: Mon Jun 16, 2008 6:56 pm

Re: How to create query to PostgreSQL

Postby WhiteRider » Sat Apr 10, 2010 2:17 pm

holdem_limit.amt_bb actually stores the big bet amount for limit poker.
WhiteRider
Moderator
 
Posts: 54025
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: How to create query to PostgreSQL

Postby TROM » Sun Apr 11, 2010 12:46 am

no you wrong
holdem_limit.amt_bb its big blind amount
look manual on page 22

But anyway I think I just need limit ID table
Where I can find this table ?

for example what I need
Limit id 14447 - FL 0.02/0.04$
Limit id 14445 -FL 0.02/0.04$(6max)
TROM
 
Posts: 57
Joined: Mon Jun 16, 2008 6:56 pm

Re: How to create query to PostgreSQL

Postby WhiteRider » Sun Apr 11, 2010 4:40 am

The documentation is incorrect - it will be updated but I don't know when that will be done.
The numbers are different in every database - it depends on what order you import the different limits.
WhiteRider
Moderator
 
Posts: 54025
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: How to create query to PostgreSQL

Postby TROM » Sun Apr 11, 2010 5:43 am

ok but how to choose in query for example
limit FL 0.02/0.04$(6max)

when I write
L.amt_bb = %BB%"

I get sum of all FL 0.02/0.04$ (6max, 10max, head up and etc)
but what i do to write in my query to choose
only
limit Fixed Limit 0.02/0.04$(6max)

If ID differnt in each database I cant use it
TROM
 
Posts: 57
Joined: Mon Jun 16, 2008 6:56 pm

Re: How to create query to PostgreSQL

Postby kraada » Sun Apr 11, 2010 8:47 am

You want to add another and statement to narrow down your limit selection by using the limit_name column. You've already got the big blind amount, so for 6 max all you would need to do is:
AND L.limit_name LIKE "%6 max%"

for 2 max:
AND L.limit_name LIKE "%2 max%"

Of course there is nothing that says "full ring", so you would need to say for FR hands:

AND L.limit_name NOT LIKE "%2 max%"
AND L.limit_name NOT LIKE "%6 max%"
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: How to create query to PostgreSQL

Postby TROM » Sun Apr 11, 2010 8:58 am

thanks! :D

But how specific game type
Fixed limit, No limit, Pot limit ?
TROM
 
Posts: 57
Joined: Mon Jun 16, 2008 6:56 pm

Re: How to create query to PostgreSQL

Postby kraada » Sun Apr 11, 2010 9:10 am

For any FL hands: AND L.limit_name LIKE "%/%"
For any NL hands: AND L.limit_name LIKE "%NL%"
For any PL hands: AND L.limit_name LIKE "%PL%"
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Previous

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

Who is online

Users browsing this forum: No registered users and 0 guests