Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
398 B
1
Indexable
Never
SELECT wands.id, wands_property.age, wands.coins_needed, wands.power FROM wands, wands_property WHERE wands_property.is_evil=0 AND wands.code=wands_property.code
AND 
wands.coins_needed = (SELECT MIN(A.coins_needed) FROM wands AS A INNER JOIN wands_property AS B ON A.code = B.code WHERE wands_property.age = B.age AND A.power = wands.power                         )
ORDER BY power DESC , age DESC;