Ollivander's Inventory

  • + 0 comments

    The following worked for me: SELECT W.id, WP.age, W.coins_needed, W.power FROM Wands W INNER JOIN Wands_Property WP ON W.code = WP.code WHERE WP.is_evil != 1 AND W.coins_needed = (SELECT MIN(W2.coins_needed) FROM Wands W2 INNER JOIN Wands_Property WP2 ON W2.code = WP2.code WHERE WP2.age = WP.age AND W2.power = W.power) ORDER BY W.power DESC, WP.age DESC

    PLEASE UPVOTE!!!