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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-10-29 : 08:26:17
|
| Prathap writes "Guys,I am right now executing the following statement.Select Max(Revenue),Customer from Table1 where DATE between '01-SEP-2004' and '30-SEP-2004' and Primary_col_no = 'XXXXXXX'Group by YThe Result is Max(Revenue) Customer10000 Y120000 Y219000 Y3Now my requirement is I should be able to select Max(Customer) as Y2 which corresponds to Max(revenue).Kindly Advice.Thx" |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2004-10-29 : 08:40:07
|
[code]Select top 1 Max(Revenue), Customer from Table1 where DATE between '01-SEP-2004' and '30-SEP-2004' and Primary_col_no = 'XXXXXXX'Group by YOrder By 1[/code]Corey |
 |
|
|
|
|
|