Monday, September 20, 2010

MSSQL alternative to Distinct clause

Here's an alternative way of using DISTINCT clause. I've tested this several times versus the DISTINCT clause and yields to faster performance.

using DISTINCT clause:

SELECT DISTINCT([name]) FROM Table1

alternative:

SELECT [name] FROM Table1
GROUP BY [name]

See screenshot:

No comments:

Post a Comment