Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select Max -vs- Select Top
Message
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Select Max -vs- Select Top
Miscellaneous
Thread ID:
00502179
Message ID:
00502179
Views:
79
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?
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Next
Reply
Map
View

Click here to load this message in the networking platform