Hi Newsgroup
Hipe you can help me, I have a problem with a nested select. I have two
tables; one with products and one with prices of these products:
product
- id, name
price
- pro_id, price, time (pro_id relates to product.id)
Each product gets a new prices during time and I would like to join the
two tables, but only get the newest price. Following SELECT should do
it, but it fails and I cant' find the error:
SELECT * FROM prices cp, product pro WHERE cp.product_id=pro.id AND
cp.time IN ( SELECT MAX(cp1.time) FROM prices cp1 WHERE
cp1.product_id=cp.product_id );
The error message is the following:
#1064 - You have an error in your SQL syntax. Check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'SELECT MAX(cp1.time)
FROM mr_campaign_prices cp1
WHERE cp1.
Thanx alot...