I have a SQL script which contains an insert statement in the following format:
What is the reason/advantage of formatting an INSERT statement in this manner?
Code:
;WITH T1 AS
(
SELECT DISTINCT
a bunch of fields
FROM dbo.tblTable1 t1
INNER JOIN dbo.tblTable t2
ON t1.fldT1Key = t2.fldT1Key
)
INSERT INTO dbo.tblTable3
SELECT
a bunch of fields
FROM T1