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?
I have played around with it but can't figure it out.
here's a quick way:
SELECT item, price
ORDER BY price DESC LIMIT 1
spacephoenix, i think there might have been only one table involved in this question
Assuming that your items table is called "items" and that the item name field is called "name"
MAX(orders.price) AS highest_price
, items.name AS item
items_ordered AS orders
items.item_id = orders.item_id
I did wonder if it was just one table. Andwise, is it one table or is it two tables?
It is one table. Sorry for not specifying. I never considered using the limit function.
Thanks for your help.