Executing query with group by and aggregate on a dataset

S

sudarsan1980

i have a dataset which pull all the info into a table , now i want to
use queries based on that table.
as an example in the following query it has both aggregate and group
by . is there a way i can execute such a statement on the dataset and
retrieve data. if sample code is given will appreciate.
i just need to retrieve data from datatable any method will do either
datatable or data row whatever as long as it work....
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


thanks,
dotnetcoder
 
M

Miha Markic [MVP C#]

Hi,

If I understand properly you want to execute sql statements against a
dataset.
No, it is not possible out of the box.
Either you do a loop by yourself or use a 3rd party product (if I recall one
was advertised in this ng few months or so ago)
 

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

Similar Threads


Top