reading again i think it should beselect a.description, a.reference, s.date, s.pricefrom Article a join Sales s on a.code = s.articlejoin(select article, max(date) as [date] from salesgroup by article) ton s.article = t.article and s.[date] = t.[date]
as code in sales represent code of sale and not articleanother way is thisselect description, reference, [date], pricefrom(select a.description, a.reference, s.[date], s.price,row_Number() over (partition by a.description order by s.date desc) as seqfrom Article a join Sales s on a.code = s.article)twhere seq=1
------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/