Showing posts with label Microsoft SQL Correlated Subquery. Show all posts
Showing posts with label Microsoft SQL Correlated Subquery. Show all posts

Wednesday, 28 February 2018

Microsoft SQL Correlated Subquery

Microsoft SQL Correlated Subquery

-- Correlated Subquries are inner subqueries that are dependant on the outer query
-- Correlated inner subquries cannot run or execute on their own
-- An example is where the correlated inner subquery is joined to the outer query

select product,
(select count(*) from [test].[dbo].[options on fx majorsii] as fx2
where fx2.[Product]=fx.[Product])

from [test].[dbo].[options on fx majors] as fx;


Inline image 1