I cannot see any scope for improvement except for calculating the TotalPay once & then using the value in the derived table to calculate other values.Something like this.Select *,TotalPay*EmployeeTax/100 as EmployeeTax,TotalPay*EmployerTax/100 as EmployerTax from(SELECT dbo.SA.PID, dbo.SA.Name,COUNT(*) AS Days,SUM(dbo.SA.AHours - 4) AS RegHour,SUM(dbo.SA.AHours - 4) * dbo.SA.RegularHourlyRate AS RegPay,SUM(dbo.SA.AHours - 8) AS OTHour,SUM(dbo.SA.AHours - 8) * dbo.SA.OTHourlyRate AS OTPay,SUM(dbo.SA.AHours) AS TotalHours,((SUM(dbo.SA.AHours - 4) * dbo.SA.RegularHourlyRate) + ( SUM(dbo.SA.AHours - 8) * dbo.SA.OTHourlyRate)) as TotalPayFROM dbo.SA )T
Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless. PBUH