In SQL Server 2008:
I have one table and I want to do something in the following lines:
SELECT T1.stuff, T2.morestuff from ( SELECT code, date1, date2 from Table ) as T1 INNER JOIN ( SELECT code, date1, date2 from Table ) as T2 ON T1.code = T2.code and T1.date1 = T2.date2
Two subqueries are identical. Is there a way to do this without repeating the script subquery?
thanks
Charles
source share