SQL Query (date / money won / hours played) half done

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

SQL Query (date / money won / hours played) half done

Postby rizzobox » Sat Jul 19, 2008 3:09 pm

Hi, don't know where to post this but I guess this is the right place.

I currently have an SQL query that lists day's Ive played and the money won, as seen below.

Code: Select all
SELECT date_trunc('day', g.date_played) as Day, SUM( (gp.total_won - gp.total_bet) ) AS Winnings
  FROM game g, game_players gp
  WHERE gp.player_id = (SELECT player_id FROM players WHERE screen_name = 'alias')
  AND g.date_played >= '01-Jul-2008'
  AND gp.game_id = g.game_id
  GROUP BY Day
  ORDER BY Day ASC;


I would like to add a colum that shows me the "true hours played" for each day. As if I've played 2 hours on 4 tables, it will show 2 hours. (same as checking the box in session notes in PT2)

Help would be greatly appreciated!
rizzobox
 
Posts: 27
Joined: Sat Jul 19, 2008 3:01 pm

Return to PostgreSQL Forum

Who is online

Users browsing this forum: No registered users and 0 guests