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.
Robi writes "my question is:I want do the query like:select *, max(number1)from table1where ..group by f1,f2,f3In SQL server7, I know the syntax is wrong, but my question is what's the right one.The table is really big, and at least has 150 fields, how can I finish the work.Thank you very much"
Page47
Master Smack Fu Yak Hacker
2878 Posts
Posted - 2002-08-09 : 11:22:16
select t.<col_list>from table1 t inner join ( select f1,f2,f3,max(number1) as maxnumber1 from table 1 group by f1,f2,f3 ) dt on (t.f1 = dt.f1 and t.f2=dt.f2 and t.f3=dt.f3 and t.number1 = dt.maxnumber1)