i'm kind of new in sql, right now I'm trying to get the best average for each group(GRP) and i have this table.
i'm tryng to get something like this, but im not sure how to do it
i'm kind of new in sql, right now I'm trying to get the best average for each group(GRP) and i have this table.
i'm tryng to get something like this, but im not sure how to do it
select *
from (
select dense_rank() over (partition by grp order by g_avg desc) as rn
, *
from (
select sid
, grp
, first
, last
, avg(points) as g_avg
from YourTable
group by
sid
, grp
, first
, last
)
)
where rn = 1