vsamantha35 - Thursday, December 21, 2017 12:38 PM
Two choices.
One, don't sort in SQL Server and have the application that receives the data sort it there if needed.
Two, create a filtered nonclustered index on the table like this:
CREATE NONCLUSTERED INDEX idx_Sample ON [LubeAnalyst].[Sample] (
[x].[DateDrawn] DESC
,[x].[EquipmentLife] DESC
,[x].[LubricantLife] DESC
,[x].[DateRegistered] DESC
,[x].[SampleID]
)
WHERE [SampleStatusID] = 1;