Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

sql server select last row of each item in group by column

select ID, Name 
FROM (select ID, Name, -- add other columns here
             ROW_NUMBER() over (partition by Name ORDER BY ID DESC) as MAX_ID
      from Customer) x
WHERE MAX_ID = 1
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sql #server #select #row #item #group #column
ADD COMMENT
Topic
Name
5+4 =