CREATE TABLE #Tmp (MyColumn Int Identity(1,1),MyDescription varchar(100))Create Table #Tmp2 ( ACol int )Insert into #Tmp Values ('Hello'),('World'),('Mom')Insert into #Tmp2Values (1),(2),(3),(4)Select MyColumn from #TmpWhere MyColumn In (Select MyColumn from #Tmp2) Select MyColumn from #TmpWhere MyColumn In (Select xyz from #Tmp2)
CREATE TABLE Table1 (Col1 INT);CREATE TABLE Table2 (Col2 INT);SELECT Col1 FROM Table1 WHERE EXISTS (select 1 FROM Table2 where col2 = col1) -- col1 in Table 1, Col2 in table 2
Select * from Student where Student.student_id in (Select emp.student_id from emp)
We walk in the dark places no others will enterWe stand on the bridge and no one may pass