max id in sql server code example
Example 1: SQL get max per id
select name, max(value)
from out_pumptable
group by name
Example 2: 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