MySQL Forums
Forum List  »  Newbie

Re: help creating sql query
Posted by: Jay Pipes
Date: August 10, 2005 09:31AM

Absolutely, Felix. I really need another cup of coffee.... :)

SELECT p1.idshop, p1.iditem, p1.price, p2.last_date
FROM price p1
INNER JOIN
(
SELECT idshop, iditem, MAX(date) as last_date
FROM price
GROUP BY idshop, iditem
ORDER BY idshop, iditem
) as p2
ON p1.idshop = p2.idshop
AND p1.iditem = p2.iditem
AND p1.date = p2.last_date

Jay Pipes
Community Relations Manager, North America, MySQL Inc.

Got Cluster? http://www.mysql.com/cluster
Personal: http://jpipes.com

Options: ReplyQuote


Subject
Written By
Posted
August 10, 2005 06:22AM
August 10, 2005 07:48AM
August 10, 2005 09:17AM
Re: help creating sql query
August 10, 2005 09:31AM
August 10, 2005 09:32AM
August 10, 2005 10:04AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.