sql server 2005 - how to take out the average in a single query and also checking the average greater than certain value and arranging in ascending order -


display average basic salary each department , include employees having more 20 years age? , display departments average basic salary more 5000? sort output in ascending order of average basic salary?

plz tell me single query statement

thanks, churchill

this may help:

select t.dept,t.salary  (select dept,avg(salary) salary employee age > 20 group dept)t t.salary > 5000 order t.salary asc 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -