Manish Trivedi
Manish Trivedi

Reputation: 3559

get distinct value with last row value of other column

if my databse table is like::

id name  
1  Mani  
1  Manish  
2  mani  
2  manish  
3  abcd  
4  efgh  

now i want to lik::

id name  
1  Manish  
2  manish  
3  abcd  
4  efgh

(I need to distinct value of id and last row value of name by sql query)

Upvotes: 0

Views: 567

Answers (1)

Longha
Longha

Reputation: 741

select id, MAX(name) name
from YourTable
group by id

IF that´s doesn't matter it.

Upvotes: 1

Related Questions