Hi guys, I'm tryng to create a simple query who return me the employee with the salary over the average. Using adventure works like sample:
select firstname, lastname, avg(baserate) as avgbaserate, baserate from dimemployee group by DepartmentName having baserate >avg(baserate)
I've tried the query above. Having an average I want know who is over the average and who is under. I could create two stored prodecure, one who give me the average and one who select the results. But I'm wondering how I can extract the data using a simple query. Any advice? Thank you a lot.