Answer the question
In order to leave comments, you need to log in
How to get the maximum price from another table?
There are 2 tables
items
id | name
history
id | item_id | price | date
How to get a table like
item_id | name | price (maximum price for this product in the entire table) | date
Answer the question
In order to leave comments, you need to log in
SELECT items.id AS `item_id`, items.name AS `name`, MAX(history.price) AS `max_price`, history.date AS `date` WHERE history.item_id = items.id;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question