Hello
I've such a problem: there is a table "prices"
prices
fk_product_id | price | ins_date |
fk_product_id - product ID (foregn key),
price - product price,
ins_date - insert date
In this table I store product prices and field "ins_date" helps me to have something like product price history.
I would like to select price from this table for current product with max ins_date.
I wrote:
$query = "SELECT a.price FROM prices a, (SELECT max(ins_date) FROM prices WHERE fk_product_id=1) b WHERE a.ins_date=b.ins_date and a.fk_product_id = 1"
But MySQL doesn't want to execute this query 🙁