var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
How can I use AVG() for small groups?
How do you use AVG in sql to manage grouped output? For example:
Given a SQL Table “Employee”
Name Salary City
John Doe 15000 Seattle
Jane Doe 30000 Redmond
Tim Wayne 25000 Seattle
Write a SQL query that would return the average salary per city in the format shown below:
Select City, AVG(Salary) from Employee where ... I don't know the rest
Where city == city or something like that?
I don't think you need a where clause. I would use the group by clause.
group by city.
do you mean something like this
,avg(salary) as avgsalary
group by city
what happened when you tested that?
Originally Posted by xarzu