Thursday, December 10, 2009

Multicolumn Subquery in SQL Server

In Oracle and Other databases, there is a support of multicolumn subqueries like,

select * from ATable where (Alpha, Beta) in (select alpha, beta from BTable)

Same can be done by exists clause in SQL Server like

Select * from ATable A where Exists (Select 1 from BTable B where B.Alpha = A.Alpha and B.Beta = A.Beta)

No comments: