theseowgroup
asked on
I need an sql statement
I have a table that contains several fields. I am going to use only three of the aggregate fields here. My SQL statement is:
select user_id, position_id, avg(g), avg(a), avg(p) from 1_f_pg_mod where user_id = 6 group by position_id;
This gives:
user_id position_id avg(g) avg(a) avg(p)
6 2 20.348837209302 28.720930232558 49.06976744186
6 1 17.640845070423 31.514084507042 49.154929577465
6 3 20.919540229885 27.931034482759 48.850574712644
What I want to achieve is to get the average of all the positions joined up and call it say 4. The results would look something like (obviously the numbers are not right):
user_id position_id avg(g) avg(a) avg(p)
6 (Joined position 1,2 and 3=4) 20.348837209302 28.720930232558 49.06976744186
This is a touch difficult to explain but hope you get the drift.
Thank you.
select user_id, position_id, avg(g), avg(a), avg(p) from 1_f_pg_mod where user_id = 6 group by position_id;
This gives:
user_id position_id avg(g) avg(a) avg(p)
6 2 20.348837209302 28.720930232558 49.06976744186
6 1 17.640845070423 31.514084507042 49.154929577465
6 3 20.919540229885 27.931034482759 48.850574712644
What I want to achieve is to get the average of all the positions joined up and call it say 4. The results would look something like (obviously the numbers are not right):
user_id position_id avg(g) avg(a) avg(p)
6 (Joined position 1,2 and 3=4) 20.348837209302 28.720930232558 49.06976744186
This is a touch difficult to explain but hope you get the drift.
Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER