mass Stars notes update SQL command no longer works

Forum with tips, support, etc, on using the PostgreSQL database with Poker Tracker. Please post any PostgreSQL questions here.

mass Stars notes update SQL command no longer works

Postby DrewOnTilt » Sun Nov 23, 2008 2:23 pm

Hello Pat et al,

I have a SQL command statement that I put together some time ago to run a mass update on my PokerStars notes. It no longer works, and I can't figure out why. Help?

It should update the notes to whatever I designate in quotes (in this case, 'ssnl6 loose 11/23/08') if the following conditions hold true.

site=pokerstars
no notes on players
player has more than 100 hands with 5 or more players in the hand
player has VPIP >=40
game is $2 6max NL or $2 6max PL

update players set general_description = 'ssnl6 loose 11/23/08'
where (players.general_description IS NULL OR players.general_description = '')
AND players.player_id IN
(select b.player_id
from game a, game_players b, game_level c
where a.game_id = b.game_id
and a.site_id = 2
and a.number_of_players >= 5
and a.game_level_id = c.game_level_id
and ((c.game_level_desc = 'NL ($2) (6 max)') OR (c.game_level_desc = 'PL ($2) (6 max)'))
group by b.player_id
having count(*) > 100 and round((sum(vol_put_money_in_pot)*1.0)/(count(*)*1.0), 2) >= 0.40);
DrewOnTilt
 
Posts: 134
Joined: Fri Jan 25, 2008 6:34 pm

Re: mass Stars notes update SQL command no longer works

Postby ptrack pat » Sun Nov 23, 2008 3:49 pm

Is it giving you a SQL error message, or is it just not updating any records? If it gives an error, what is it? If it doesn't update any records, are you sure there are really some records that should be updated?
ptrack pat
 
Posts: 4841
Joined: Sun Dec 09, 2007 12:38 pm

Re: mass Stars notes update SQL command no longer works

Postby DrewOnTilt » Sun Nov 23, 2008 5:19 pm

ptrack pat wrote:Is it giving you a SQL error message, or is it just not updating any records? If it gives an error, what is it? If it doesn't update any records, are you sure there are really some records that should be updated?


It isn't giving an error. It is just finding 0 rows to update. That is very strange because I have imported thousands of hands without recording significant notes. Does the syntax look correct?
DrewOnTilt
 
Posts: 134
Joined: Fri Jan 25, 2008 6:34 pm

Re: mass Stars notes update SQL command no longer works

Postby ptrack pat » Sun Nov 23, 2008 8:51 pm

It looks OK I think, I'm not on a PC that has PostgreSQL so I can't run it.

Maybe instead of using the game level descriptions, look in that table to see what the ID's are for those 2 levels and use the ID's instead, like...

and c.game_level_id IN ([id#1], [id#2])

Also, if you want to play around with it, you can change it into a select statement like...

select * from players
where....

so that you can run some test queries before running the actual update statement. Maybe try removing that round statement at the end to see if that might be throwing it off somehow. If it returns rows without that statement, maybe there is something wrong with that.
ptrack pat
 
Posts: 4841
Joined: Sun Dec 09, 2007 12:38 pm


Return to PostgreSQL Forum

Who is online

Users browsing this forum: No registered users and 0 guests