Ollivander's Inventory

  • + 0 comments

    with cte as ( select w.ID ,wp.age,w.coins_needed,w.power,ROW_NUMBER() over (partition by w.power,wp.age order by w.power desc,wp.age desc) as t from wands w join wands_property wp on w.code=wp.code where wp.is_evil != 1 ) select ID,age,coins_needed,power from cte where t=1 order by power desc,age desc,coins_needed asc