I know that the following will return the highest price in the 'price' column:
How can I also get it to show the corresponding item with the max price?Code:SELECT MAX(price)
FROM items_ordered;
I have played around with it but can't figure it out.
Printable View
I know that the following will return the highest price in the 'price' column:
How can I also get it to show the corresponding item with the max price?Code:SELECT MAX(price)
FROM items_ordered;
I have played around with it but can't figure it out.
Assuming that your items table is called "items" and that the item name field is called "name"
Code SQL:SELECT MAX(orders.price) AS highest_price , items.name AS item FROM items_ordered AS orders INNER JOIN items ON items.item_id = orders.item_id