Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query to list proxy

Status
Not open for further replies.

crackon

Programmer
Jun 17, 2009
26
0
0
need a query to list a proxy bid pls, my colums are

Id
Idproduct
Idcustomerbid
Bidamount

It must list highest bid for each user but not highest bid
 
Just a WAG'ing it.

Code:
Select YourTableName.*
From   YourTableName
       Inner Join (
         Select idCustomerbid, Max(BidAmount) As MaxBid
         From   YourTableName
         Group BY idCustomerbid
         ) as MaxData
         On YourTableName.idCustomerBid = MaxData.idCustomerbid
         And YourTableName.BidAmount = MaxData.MaxBid

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
What is your SQL Server version?

select * from (select Id, Idproduct, Idcustomerbid, Bidamount, row_Number() over (partition by IdCustomerBid order by BidAmount Desc) as RowNum) OrderedResult where RowNum = 1
 
If you meant SQL Server 2008, then try both versions. If you meant 80 for the version, go with George's solution.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top