You are viewing a single comment's thread. Return to all comments →
If you use group by , the select( min(coins_needed) ....query will return multiple rows and not a single value.
So, we can't write a condition such as : where coins_needed=select(min(coins_needed) ... group by...) because of multiple rows problem.
Thank you for your explanation. This is really clear and helpful!
Why I cannot use the subquery like this
coins_needed = any(select min(coins_needed) from Wands as w1 join Wands_Property as p1 on (w1.code = p1.code) group by age, power)
"any" returns true or false. You can't use it to compare it to "coins_needed".
Here, you just need to remove the "any" and add a where clause to match the correct age and power.