[Homework] 19. Cash in User Games Odd Rows
Здравейте,
Бихте ли ми помогнали да напасна този код, за да го приеме judge-а. Дава ми 0 точки, а пък си работи иначе.
create function ufn_CashInUsersGames (@GameName nvarchar(50))
returns @SumCashTable table (SumCash money)
as
begin
insert into @SumCashTable (SumCash)
select sum(rn.Cash)
from (select GameId, Cash,
ROW_NUMBER() over (partition by GameId order by GameId asc) as 'RowNumber'
from UsersGames
join Games on (UsersGames.GameId=Games.Id)
where Games.Name=@GameName) as rn
where (rn.RowNumber%2<>0)
return
end
Мерси за отговора!