Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select Max -vs- Select Top
Message
De
01/05/2001 17:34:52
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00502179
Message ID:
00502275
Vues:
20
Even shorter

SELECT Max(DataInsertion)
FROM Titre

But, I think all these will be optimized and got the same. Look at the query plan for each.

>What are the differences between these 2 queries:
>
SELECT *
>FROM Titre
>WHERE DateInsertion = (
>	SELECT MAX(DateInsertion)
>	FROM Titre)
>
>AND
>
>
SELECT *
>FROM Titre
>WHERE DateInsertion = (
>	SELECT TOP 1 DateInsertion
>	FROM Titre
>	ORDER BY DateInsertion DESC)

>
>I found that the second syntax can be a lot faster.
>
>Can I safely replace my SELECT MAX with SELECT TOP?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform