Skip to content
Advertisement

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 get mean of exams by client with 2 tables?

I know a little bit of sql, only the basic, now I need to create a analytic query but can’t do this yet. I have 2 tables on my db oracle, client and exams: I am tried a lot of ways to get the mean of exams by client, but no success yet.4 The result expected is: exams = 13

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

SQL – An aggregate may not appear in the WHERE clause unless it is in a subquery contained in a HAVING clause

If you see the picture below, I only want to see those categories where the average revenue is greater than the overall average. The query that I’m using is below. The very last line is causing the issue. The error that I’m getting is: An aggregate may not appear in the WHERE clause unless it is in a subquery contained

Advertisement