Ollivander's Inventory

  • + 0 comments

    /* ms sql */

    select id,age,coins,power from (select w.id,wp.age,w.coins_needed,w.power, row_number() over(partition by wp.age,w.power order by w.coins_needed) from wands w join wands_property wp on w.code = wp.code and wp.is_evil = 0) nw(id,age,coins,power,rn) where rn = 1 order by power desc,age desc