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.
sql server:
with minCoinsTable as(select w.code,wp.age, min(coins_needed) as minCoins from Wands as W
inner join Wands_Property as WP
on W.code = WP.code and WP.is_evil = 0
group by w.code,wp.age,w.power)
select id, age, W.coins_needed, w.power from minCoinsTable as MC
inner join Wands as W
on MC.code = W.code and W.coins_needed=MC.minCoins
order by power desc,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 →
sql server: with minCoinsTable as(select w.code,wp.age, min(coins_needed) as minCoins from Wands as W inner join Wands_Property as WP on W.code = WP.code and WP.is_evil = 0 group by w.code,wp.age,w.power) select id, age, W.coins_needed, w.power from minCoinsTable as MC inner join Wands as W on MC.code = W.code and W.coins_needed=MC.minCoins order by power desc,age desc