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 |
|
ChristopheB
Starting Member
3 Posts |
Posted - 2008-09-17 : 08:34:24
|
| Table:COL1 Col2 Col31 20 A1 15 B1 30 C2 20 D2 15 E3 30 F3 60 G3 45 H How can I get the following result1 C2 D3 GSo the letter(col3) next to the highest value of column2 for each group(Col1).It's driving me crazy.thank you,christophe |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-17 : 08:37:07
|
| [code]SELECT t1.Col1,t1.COL3FROM Yourtable t1INNER JOIn (SELECT Col1,MAX(col2)as max FROm Yourtable GROUP BY col1)tmpon tmp.col1=t1.col1and tmp.max=t1.col2[/code] |
 |
|
|
ChristopheB
Starting Member
3 Posts |
Posted - 2008-09-17 : 09:10:19
|
| Thanks |
 |
|
|
|
|
|