currently I try to use my PT-database to do some behavior-research.
To get valuable data I only consider players with a minimum of 1000 hands.
Getting this value out of the cache (which is updated before I start) is a bit hard due to the multiple lines per user:
- Code: Select all
Realmoney=# select cnt_hands from holdem_cache WHERE id_player='2';
cnt_hands
-----------
160
340
202
800
400
450
1210
520
1080
560
245
290
630
(13 rows)
As you see there are ~6800 hands of that player, yet only ~2200 find their way into my data, since the code will only consider data with 1000 hands in a single cache line:
- Code: Select all
Realmoney=# select cnt_hands from holdem_cache WHERE id_player='2' and cnt_hands>1000;
cnt_hands
-----------
1210
1080
(2 rows)
I need a way to cinsider every player with a minimum of 1000 hands in cache all together.
But while I can get this value with
- Code: Select all
Realmoney=# select sum(cnt_hands) from holdem_cache WHERE id_player='2';
sum
-----
6880
(1 row)
I don´t know how to proceed.
my idea is to create or join a table with the total numbers, or at least the total handcount...
Yet I have no clue how to continue, as I hardly know about table manupulation.
If I could save that result to a table, it would be incredible help:
- Code: Select all
Realmoney=# select id_player,sum(cnt_hands) from holdem_cache GROUP BY id_player ORDER BY id_player;
id_player | sum
-----------+------
1 | 94
2 | 6880
3 | 6
4 | 397
5 | 12
6 | 13
7 | 33
Hope someone can point me to the right direction.
THANKS a lot.