tag:blogger.com,1999:blog-495177919198719500.post6454774684364996215..comments2023-12-27T20:52:29.483-08:00Comments on Microsoft Sql Server Tutorials: Partition Data to Find the Most Recent Record in SQL Server 2005/2008Suprotim Agarwalhttp://www.blogger.com/profile/08349831623922214390noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-495177919198719500.post-75915954776755886992011-03-12T17:21:37.149-08:002011-03-12T17:21:37.149-08:00Thanks Jose. That makes a lot of sense!Thanks Jose. That makes a lot of sense!Suprotim Agarwalhttps://www.blogger.com/profile/08349831623922214390noreply@blogger.comtag:blogger.com,1999:blog-495177919198719500.post-9917371385786479852011-03-12T13:53:53.896-08:002011-03-12T13:53:53.896-08:00Hi Suprotim Agarwal,
The query you posted retriev...Hi Suprotim Agarwal,<br /><br />The query you posted retrieves the first order placed by the customer. In order to retrieve the most recent you should add the keyword DESC to the order by in the ROW_NUMBER. <br />something like:<br />ORDER BY OrderDate DESC<br /><br />Cheers,<br />JoseUnknownhttps://www.blogger.com/profile/10439697971853185690noreply@blogger.com