by kraada » Thu Sep 23, 2010 10:52 am
The following query will get you player name, notes, VP$IP and PFR - you can add more stats if you'd like but it's a bit longwinded and you'll see why in a moment. In PGAdmin III, run the following query, saving the output to a file. You'll get one line per note, which means you'll get the same name/vp$ip/pfr several times. But they'll be sorted so it should make sense.
SELECT p.player_name as "Name", n.notes as "Notes", (sum(h.cnt_vpip)::numeric(11,2) / sum(h.cnt_hands)::numeric(11,2)) * 100 as "VP$IP", (sum(h.cnt_pfr)::numeric(11,2) / sum(h.cnt_hands)::numeric(11,2)) * 100 as "PFR" FROM player p, notes n, holdem_cache h WHERE p.id_player = n.id_x and n.enum_type = 'P' and p.id_player = h.id_player group by p.player_name, n.notes order by p.player_name asc;
To add more stats, put it in before the "FROM", offset from "PFR" by a comma. The basic structure here (using cache data) is: sum(h.column_name)::numeric(11,2) - that gets you data from any given column. You can then put them together to build whatever stats you would like - naming them (as "StatName") changes the header so it's easier to remember what you're seeing as the result.
I did check and this query does work, but remember you get one line per note so you'll end up with a lot of lines in the report.