You are viewing a single comment's thread. Return to all comments →
MySQL. In the beginning I had trouble with the output because SELECT output wands with a minimum coins needed that didn't always match with that wand.
SELECT
There is a sub-query to make sure that if the wand age and wand power matches with another, to return the cheapest (lowest coins_needed) wand with.
SELECT W.id, P.age, W.coins_needed, W.power FROM WANDS AS W INNER JOIN WANDS_PROPERTY AS P ON W.code = P.code WHERE P.is_evil = 0 AND W.coins_needed = (SELECT MIN(coins_needed) FROM WANDS AS W1 INNER JOIN WANDS_PROPERTY AS P1 ON W1.code = P1.code WHERE W1.power = W.power AND P1.age = P.age) ORDER BY W.power DESC, P.age DESC
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 →
MySQL. In the beginning I had trouble with the output because
SELECT
output wands with a minimum coins needed that didn't always match with that wand.There is a sub-query to make sure that if the wand age and wand power matches with another, to return the cheapest (lowest coins_needed) wand with.