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, C1A1, B2, C2A1, B3, C3I 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, column3from @t1 tjoin cteon t.column1 = cte.column1 and t.column2 = cte.column2Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
|
|
|