Page 4 of 5

Re: Hand Groupings

PostPosted: Mon May 06, 2013 7:11 pm
by PJs Ronin
BillGatesIII wrote:
PJs Ronin wrote:@BillGatesIII

Care to share?
...

Next step is to create a custom stat. I'll explain that one tonight after work :)


I see where you're going... nice. Look forward to next instalment which will be the key to getting this into a stat(s). Stab in the dark assessment, but there is some serious upside potential to this methodology.

Re: Hand Groupings

PostPosted: Tue May 07, 2013 3:07 am
by BillGatesIII
The column for the stat is a single query.
Code: Select all
select group_rank from lookup_starting_hand_ranks lshr where lshr.id_holecard = (tourney_hand_player_statistics.id_holecard)

Clipboard06.png

Make sure to tick the 'Group by' check box.

The stat itself is rather straightforward and can be used in any Hand Report.
Clipboard07.png


Looking at it now, I would prefer to use different names for the tables, columns and stats. Something with holecard and the type of ranking in it to separate it from the built in _hand_rank_group columns.

Re: Hand Groupings

PostPosted: Tue May 07, 2013 4:27 am
by PJs Ronin
lack of sleep... making stupid mistakes... back in 12 hours.

Re: Hand Groupings

PostPosted: Tue May 07, 2013 9:15 pm
by PJs Ronin
Ok, after getting postgress sorted out (hard for PT4 to link to a db when postgres isn't running :oops: ), I created a table called 'hand_group' with two columns. First column (primary key) called 'id' which is just a sequential listing from 1 to 169. Second column called 'rank' that identifies which group (1-9) the id falls in to. Time consuming, but easy peasy.

When I try and create the column with:

Code: Select all
select group_rank from lookup_starting_hand_ranks lshr where lshr.id_holecard = (tourney_hand_player_statistics.id_holecard)

I get "The statement is not valid SQL".

Suggestions?

Re: Hand Groupings

PostPosted: Wed May 08, 2013 1:57 am
by tarix
Code: Select all
SELECT group_rank FROM lookup_starting_hand_ranks AS lshr WHERE lshr.id_holecard = (tourney_hand_player_statistics.id_holecard)


It was missing an "AS".

Re: Hand Groupings

PostPosted: Wed May 08, 2013 3:46 am
by PJs Ronin
tarix wrote:
Code: Select all
SELECT group_rank FROM lookup_starting_hand_ranks AS lshr WHERE lshr.id_holecard = (tourney_hand_player_statistics.id_holecard)


It was missing an "AS".

I get the same result, not valid SQL.

Re: Hand Groupings

PostPosted: Wed May 08, 2013 4:25 am
by BillGatesIII
@tarix: AS is optional in FROM items.

@PJs: Your table is called hand_group (and the columns also have different names) so the SQL should look something like this:

SELECT rank FROM hand_group hg WHERE hg.id = (tourney_hand_player_statistics.id_holecard)

But, rank() is a built in Postgres function so I think it's better to rename that column to something else (and change the SQL accordingly). Also, renaming the primary column to id_holecard might fix things.

One last thing is to put the SQL in one line, so no carriage-returns, because sometimes the PT4 parser will not accept this.

Re: Hand Groupings

PostPosted: Wed May 08, 2013 5:10 am
by PJs Ronin
@ Bill,

Damn you Sir, you a dragging my old brain out of it's peaceful retirement.

I had a feeling the gist of the SQL statement was as you described, but would never have worked out that rank() may throw a shoe. Thanks for your help on this, will be back in 12 hours. (there are some benefits and impediments to living on the opposite side of the world)

Re: Hand Groupings

PostPosted: Wed May 08, 2013 4:38 pm
by BillGatesIII
Do you live on the opposite or do I live on the opposite side of the world :)

Re: Hand Groupings

PostPosted: Wed May 08, 2013 8:53 pm
by PJs Ronin
Success !

Thank you :)

Btw, I'm in Perth, West Aust which is about as far from anywhere you can get and still be on the planet.

Regards, I'm off to do some modifying !

highfalutin