Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select top 3 within a group
Message
De
16/06/2006 20:48:15
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01129690
Message ID:
01129694
Vues:
31
>Try
>
>SELECT * FROM mytable mt1 ;
>	WHERE NOT EXISTS (SELECT * FROM mytable mt2 ;
>				WHERE mt2.team = mt1.team ;
>					AND mt2.score > mt1.score;
>					HAVING COUNT(*) > 2	)	
>
I got a "Group by clause missing or invalid" when I tried this. Putting a "GROUP BY team" before the HAVING clause didn't change the error.

My attempt was
SELECT * FROM myTable mt1;
 WHERE score IN (SELECT score FROM myTable mt2 WHERE mt1.team = mt2.team ORDER BY score DESC TOP 3)
This generated a "Function name is missing )" error. It seems that any ORDER BY inside a IN() clause generates this error. Could you please explain why?

Thanks.....
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform