Hi ,I have retrieved the data using CTE . But still need the retrieve the latest row number record from my result.;with cte as (Select ROW_NUMBER() over ( PARTITION by [T7S1_PRODUCT_CDE_original],[T7S1_BR_NO_original] order by [sql_updated] ) rn , [sql_updated] ,[T7S1_TYP_CDE] ,[T7S1_PRODUCT_CDE_original] ,[T7S1_BR_NO_original] from [interface_i084].[dbo].[tb_i084_ds_CeresTLStageFileDocDetail](nolock) )Select * from cte My Query result:rn sql_updated T7S1_TYP_CDE T7S1_PRODUCT_CDE_original T7S1_BR_NO_original1 2012-06-26 00:17:32.007 703 A0200030OOO 000662 2012-06-27 12:30:21.803 703 A0200030OOO 000663 2012-07-13 01:15:36.073 703 A0200030OOO 000661 2012-06-27 12:45:30.653 703 A0200030OOO 000831 2012-06-25 07:45:33.907 703 A0200030OOO 000902 2012-08-16 12:45:22.227 703 A0200030OOO 00090Now Expecting:rn sql_updated T7S1_TYP_CDE T7S1_PRODUCT_CDE_original T7S1_BR_NO_original3 2012-07-13 01:15:36.073 703 A0200030OOO 000661 2012-06-27 12:45:30.653 703 A0200030OOO 000832 2012-08-16 12:45:22.227 703 A0200030OOO 00090I want to retrieve the MAX rn record.. Please suggest
Vijay is here to learn something from you guys.