Please help me with a query. Assume that we have a table with columns:
- Transaction
- StartTime
- EndTime
Now, I need a query with computed column of (value = EndTime-Startime).
Actually I need to group Users(Transaction has a FK for Users) and sort them by average time spent for transaction.
You should look into the DateDiff function. You did not specify the units of the timespan, so I assumed seconds in my solution: