can somebody help me understand how is this alias for the select stmt diff than a temp table? would putting in a temp table be an optimal solution? Scenario1: select * from tabl1 inner join ( select * from table 3 inner join table 4 on table3.col1 = table4.col1) AliasName on AliasName.col4 = tabl1.col1
Scenario2 Create table #tempAliasName (col1, col2, col3, col4) insert into #tempAliasName (select * from table 3 inner join table 4 on table3.col1 = table4.col1)
select * from tabl1 inner join #tempAliasName on #tempAliasName.col4 = tabl1.col1
Please help me understand the diff between 2 scenarios (wrt optimization, good querying practice, overhead on server) if any?