Skip to content

Tag: average

How to show the average and use it like condition in the same query?

I am working with a data base and I need to show the people who are older than the age average in a city comparing their age against that average. My code shows the people who is older than the average….but I can’t show the average of all the people (it’s allways the same number) in each line. I need

How to find the average time? SQL Server 2017

I have a request like this: I need to find the average time for each status. For example, add up the time of all statuses 2 and divide by their number. As a result, get something like 2 days 5 hours. How to fix my request to make belt operations possible? Answer Taking your limited example data, something like this