DBMS: SQL Server 2012 Express
I have an SQL Statement which looks something like this:
SELECT OverSpeedings = SUM(OverSpeeding), OverspeedingPoints = SUM(OverSpeeding) * 5, FROM MyTable GROUP BY COLUMNS_HERE
I was wondering does Adding the same column twice cause an impact on Performance? Meaning does SQL Server add the column twice? Or will it add the column once and use for both columns in the result set?
Or should I use a CTE with one
SUM like the following:
SELECT OverSpeedings, OverspeedingPoints = OverSpeedings * 5, FROM ( SELECT OverSpeedings = SUM(OverSpeeding) FROM MyTable GROUP BY COLUMNS_HERE ) A