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)
 Selecting Max Value

Author  Topic 

ASPSQLVB
Starting Member

46 Posts

Posted - 2007-01-08 : 20:08:33
Gang,

I am trying to select the TOP 3 anglers with the most in totalweight. TotalWeight is a column in the TotalWeight Table.
Below is the SQL statment I have.
Thank You.

SELECT TOP 3 Fish.*, BigFish.*, FishAngler.*, TotalWeight.* FROM BigFish INNER JOIN FishAngler ON BigFish.FishId = FishAngler.FishId INNER JOIN Fish ON FishAngler.FishId = Fish.FishId INNER JOIN TotalWeight ON FishAngler.FishId = TotalWeight.FishId

Kristen
Test

22859 Posts

Posted - 2007-01-08 : 20:21:34
Does adding

ORDER BY TotalWeight.TotalWeight DESC

get what you want?

Kristen
Go to Top of Page

ASPSQLVB
Starting Member

46 Posts

Posted - 2007-01-08 : 20:50:00
Yes id Does. Thank You Kristen. Enjoy!!
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-01-08 : 22:31:52
I caught a 320 lb shark in the Indian Ocean many years ago - would that make the top 3?
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-09 : 04:52:27
My best catch ever was two years ago. 128 lb girlfriend...


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-01-09 : 04:58:12
Oh does this mean, Kristen's 320lb shark is his . . . . . .


KH

Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-01-09 : 06:01:04
Peter is you girlfriend reading this by any chance?
she's be both pissed and pleased with you right now




Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-09 : 08:15:59
Sometimes she leans over and read my posts here.
Oh, you mean about the weight? It is 60 kg, which is quite normal here in Sweden (actually lower limit).


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -