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.
| Author |
Topic |
|
lloydnicholson
Starting Member
5 Posts |
Posted - 2002-11-04 : 05:47:48
|
| I have two table - tblleaderboard and tblprizesTblleaderboard id intname varchartotal numericTblprizesid intprize varcharNow what I want to do is create a query that returns the whole tblleaderboard ordered by total desc but with the corresponding prize from the prize table. There are 200 prizes in the table. The top prize has an id of 1, second prize is 2 and so on. This is as far as I can get...SELECT A.ID, A.total, a.name, (SELECT COUNT(*) + 1 FROM Tblleaderboard B WHEREB.total > A.total) RANK FROM Tblleaderboard AORDER BY RANK;My idea was to link the Rank to the tblprize.id in a sub query but I can't get it to list all of the leaderboard table. Many thanks,Lloyd |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
|
|
lloydnicholson
Starting Member
5 Posts |
Posted - 2002-11-04 : 06:16:22
|
| Thanks for your help,LloydEdited by - lloydnicholson on 11/04/2002 06:54:07 |
 |
|
|
|
|
|