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.
Author |
Topic |
ktrkanjec
Starting Member
1 Post |
Posted - 2014-08-05 : 15:33:40
|
Hello, need help, from table with structure: A1, B1, C1 A1, B2, C2 A1, B3, C3
I need SQL statement with result:
A1, max of B with appropriate C.
Thanks! |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-08-05 : 15:51:27
|
;with cte (column1, column2) as (select column1, max(column2) as column2 from @t1 group by column1) select cte.column1, cte.column2, column3 from @t1 t join cte on t.column1 = cte.column1 and t.column2 = cte.column2
Tara Kizer SQL Server MVP since 2007 http://weblogs.sqlteam.com/tarad/ |
 |
|
|
|
|