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)
 Last three of an game

Author  Topic 

gerten
Starting Member

17 Posts

Posted - 2004-10-30 : 19:31:07
I have an table "Resultat" Where there is sveral players with diffrent results in one game "Omgang". I would like to sort the three last games like:
Nr Spelare Omgang Resultat H_B Serier Poang Lag
----------- ----------- ----------- ----------- ----- ----------- ----------- -----
163 8 6 727 H 4 4 A
164 8 5 789 H 4 3 A
165 8 4 704 H 4 3 A
166 14 6 734 H 4 3 A
167 14 5 792 H 4 3 A
168 14 4 764 H 4 4 A
169 32 6 800 H 4 3 A
170 32 5 733 H 4 3 A
171 32 4 702 H 4 2 A

I tryed following query but get only last game

SELECT Omgang,*
FROM Resultat WHERE Omgang IN(SELECT TOP 3 Omgang FROM Resultat ORDER BY Omgang DESC) ORDER BY Resultat DESC ,Spelare


Pls help me out

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2004-10-30 : 19:58:20
Try:
SELECT Omgang,*
FROM Resultat WHERE Omgang IN(SELECT TOP 3 DISTINCT Omgang FROM Resultat ORDER BY Omgang DESC) ORDER BY Resultat DESC ,Spelare


rockmoose
Go to Top of Page
   

- Advertisement -