HI All
I am stuck with this query and would appreciate all help given. What I am trying to find out is top 3 customergroup ranked as 1,2,3 per day based on game win in descending order something like this as an example
I have written few codes but neither of them are correct
1st attempt:-
select * from
(
select Row_number() over (PARTITION by [customer group] order by [customer group],last_day_of_week)as row_num,sum(real_gw)as total,last_day_of_week,[Customer Group]
from
[data_improvised]
group by
[Customer Group],LAST_DAY_OF_WEEK
)a
where row_num in (1 ,2, 3)
order by LAST_DAY_OF_WEEK desc
2nd attempt: -
select
top 3 with ties SUM(real_gw),LAST_DAY_OF_WEEK,[Customer Group]
from data_improvised
group by LAST_DAY_OF_WEEK,[Customer Group]
order by ROW_NUMBER() over(partition by [customer group] order by last_day_of_week desc)
Thanks for your help. Any help would be appreciated
REgards
Farhan JAmil