Scorpion Scorpion - 7 months ago 17
SQL Question

mysql check values from sub query

**** SOLVED ****

SELECT price
FROM inventory
WHERE price > ANY (SELECT price FROM inventory WHERE type = 'new');


Thank you to Mohammed Shafeek and every one else that commented.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I am trying to check if a price is higher than any of the prices in a sub-query.

SELECT price
FROM inventory
WHERE price > price IN (SELECT price FROM inventory WHERE type = 'new');


So I want to be able to check if a price is higher than at least one of the values from the sub-query.

Any help would be much appreciated.

**** EDIT ****

Example of what i mean

$20 > $15, $30, $50

So because $20 is greater than $15 it would be selected

Would this be Min(price)

Like mentioned in below comments

Thanks in advance.

Answer
SELECT price
FROM inventory
WHERE price > ANY (SELECT price FROM inventory WHERE type = 'new');

I think this is the query actually u want.Check it