Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL group by

Darshan D BFeb 21 2024

I need to display employees details whose salary is greater than average salary of their department. below is table

Table:

I know that we can easily find the solution using subquery and other methods but I need to know why below group by solution not working.

Solution 1) This solution is giving correct result, when I only join ON dept_name

solution 2 ) Below code is giving wrong result when I add extra condition with emp_id.

This post has been answered by Cookiemonster76 on Feb 21 2024
Jump to Answer
Comments
Post Details
Added on Feb 21 2024
4 comments
208 views