ArticleID Price Date 1 50 2010-12-23 1 52 2012-10-22 2 102 2009-02-06 2 95 2007-05-30 2 89 2011-09-12 3 41 2006-01-21 3 63 2012-03-16
SELECT A1.* FROM (SELECT ArticleID, MAX(Date) AS Latest FROM Articles GROUP BY ArticleID) A2, Articles A1 WHERE A1.ArticleID = A2.ArticleID AND A1.Date = Latest
SELECT A.ArticleId,A.Cost,A.Date FROM ( SELECT ArticleId,Cost,Date, ROW_NUMBER() OVER(PARTITION BY ArticleId ORDER BY Date DESC) ROWNUM FROM Articles ) AS A WHERE A.ROWNUM = 1
SELECT TOP 1 * FROM Articles ORDER BY Date DESC
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)