Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

sql server select record with max id

select ID , ProductCatId , ProductCode , Price
  from (
        select ID , ProductCatId , ProductCode , Price, row_number() over (partition by ProductCatId order by ID desc) as rn
         from myTable
        ) as t
  where t.rn = 1
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sql #server #select #record #max #id
ADD COMMENT
Topic
Name
2+6 =