I'm fairly new to Oracle SQL, but already it's logic is beginning to confuse me. I'm trying to select all columns from a table where a particular column PRICE has the minimum value.
This works:
SELECT MIN(PRICE) FROM my_tab;
This returns me the minimum value. But why can't I select all the columns in that row? The following won't work:
SELECT * FROM my_tab WHERE PRICE = MIN( PRICE );
What am I missing here? Cheers folks!
*EDIT*
Here is the full code I'm having trouble with:
SELECT * FROM ( SELECT c.NAME, o.* FROM customers c JOIN customer_orders o ON c.CUST_NBR = o.CUST_NBR ) AS t WHERE t.PRICE = ( SELECT MIN( t.PRICE) FROM t );