Aggregate functions in a DataView?

P

Paul Wilkinson

I'm looking for a way to query a DataSet without saving the dataset to
disk.

For queries that don't use joins, can I use a aggregate functions in a
DataView?

What's the easiest way to do queries on DataSets for queries that do
require joins and aggregate functions?

Here is one of my queries:

SELECT off_the_button as position,
COUNT(off_the_button) AS total_hands,
SUM(total_bet) AS vol_money_in_pot,
100 * SUM(cold_call_pf) / COUNT(off_the_button) AS cold_call_pf_pct,
SUM(won_hand) AS num_won,
100 * SUM(won_hand) / COUNT(off_the_button) as win_pct,
SUM(saw_flop_n) AS saw_flop_n,
100 * SUM(won_hand) / COUNT(saw_flop_n) as win_pct_wsf,
SUM(blind_amt) AS blind_money,
SUM(total_won) AS money_won,
SUM(total_won) - SUM(blind_amt) AS diff_wo_blind$,
100 * SUM(went_to_showdown_n) / COUNT(off_the_button) AS went2sd_pct,
100 * SUM(pre_flop_raise_n) / COUNT(off_the_button) AS raise_pf_pct,
100 * SUM(raised_first_pf) / COUNT(off_the_button) AS raise1st_pf_pct
FROM game_players
WHERE player_id = 1
GROUP BY off_the_button
 
W

W.G. Ryan eMVP

DataTable.Compute will do aggregates for both scenarios. Now compute
doesn't work with a dataview, it's a datatable method, however a dataview is
always based on a DataTable so you can call compute on the table it's based
on.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top