Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
how to group by following columns and get the required output shown below?name value zoneCA129R 2748 EastCA129R 543 westCA129R 3000 northCA129R 100 south....required output:name value zoneCA129R 3000 north
TG
Master Smack Fu Yak Hacker
6065 Posts
Posted - 2011-10-25 : 14:50:41
Here's one way:
select name, value, zonefrom ( select * ,rn = row_number() over (partition by name order by value desc) from yourTable ) dwhere rn = 1