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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 select additional fields besides group list

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-07-27 : 10:14:23
Robi writes "my question is:

I want do the query like:

select *, max(number1)
from table1
where ..
group by f1,f2,f3

In 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)

 


Jay White
{0}
Go to Top of Page
   

- Advertisement -