I used to know how to do this but have forgotten. How do I set a variable to an item returned by a query using TSQL (SQL Server). I have delcared my @variable and need to set it to an item returned by ...
Use a CTE that returns the row ID and the result of the DateDiff, then join that to your existing result set? It may or may not be faster, so as always, test it to see.
Some results have been hidden because they may be inaccessible to you
Show inaccessible results