A correlated subquery is an inner subquery which is referenced by the main outer query such that the inner query is considered as being executed repeatedly. Example: ----Example of Correlated Subqueries USE AdventureWorks; GO SELECT e.EmployeeID FROM HumanResources.Employee e WHERE e.ContactID IN ( SELECT c.ContactID FROM Person.Contact c WHERE MONTH(c.ModifiedDate) = MONTH(e.ModifiedDate) ) GO A… Continue Reading...
Source: SQL SERVER – Correlated and Noncorrelated – SubQuery Introduction, Explanation and Example | Journey to SQL Authority with Pinal Dave
No comments:
Post a Comment