We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
this worked with MS SQL but not with MySQL , can someone debug it ?
with oli as (
select w.id, wp.age, w.coins_needed,w.power,
rank() over(partition by wp.age,w.power order by w.coins_needed asc) as rnk
from wands w
inner join wands_property wp
on wp.code =w.code
where wp.is_evil = 0)
select oli.id,oli.age,oli.coins_needed,oli.power
from oli
where oli.rnk = 1
order by oli.power desc , oli.age desc
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Ollivander's Inventory
You are viewing a single comment's thread. Return to all comments →
this worked with MS SQL but not with MySQL , can someone debug it ?
with oli as ( select w.id, wp.age, w.coins_needed,w.power, rank() over(partition by wp.age,w.power order by w.coins_needed asc) as rnk from wands w inner join wands_property wp on wp.code =w.code where wp.is_evil = 0)
select oli.id,oli.age,oli.coins_needed,oli.power from oli where oli.rnk = 1 order by oli.power desc , oli.age desc