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
 SQL Server Development (2000)
 Not quite sure how to do this

Author  Topic 

label
Posting Yak Master

197 Posts

Posted - 2004-05-12 : 10:18:28
I want to grab the top 2 buyer ID's from a select statement...


select top 2 buyerID from
select buyerId, max(bid) as bid
from aims.dbo.stockBid
where saleID=33
and stockID=301585
group by buyerid
order by bid desc


Right now that throws a syntax error. What do I need to do to grab just the top 2 buyer id's?

Thanks.

jjanousek
Starting Member

1 Post

Posted - 2004-05-12 : 10:34:35
try this:

select top 2
buyerId, max(bid) as bid
from aims.dbo.stockBid
where saleID=33
and stockID=301585
group by buyerid
order by bid desc
Go to Top of Page

label
Posting Yak Master

197 Posts

Posted - 2004-05-12 : 10:50:23
quote:
Originally posted by jjanousek

try this:

select top 2
buyerId, max(bid) as bid
from aims.dbo.stockBid
where saleID=33
and stockID=301585
group by buyerid
order by bid desc




That worked. Thanks!
Go to Top of Page
   

- Advertisement -