Download presentation
Presentation is loading. Please wait.
1
2 Types of Subqueries
2
Two types of Subqueries
In a noncorrelated subquery, values are passed from the inner query to the outer query. proc sql; select Job_Title, avg(Salary) as MeanSalary from orion.Staff group by Job_Title having avg(Salary) > (select avg(Salary) as MeanSalary from orion.Staff) ; quit; Stand-alone query
3
Correlated Subsqueries
4
Subqueries In a correlated subquery, the outer query must provide information to the subquery before it can be successfully resolved. proc sql; select Employee_ID, avg(Salary) as MeanSalary from orion.Employee_Addresses where 'AU'= (select Country from Work.Supervisors where Employee_Addresses.Employee_ID= Supervisors.Employee_ID) ; quit; Requires Information from the outer query
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.