'where to put insert select statement?
I have the following select statement and I want to input the results into my new table "additions" that I created. The select statement has the same columns in my new table
Select ThisWeek.*
from
(
SELECT table1, table 2, table 3, getdate() as Date,
FROM ...
where ....)
)ThisWeek
left outer join
(
SELECT ...
FROM .....
where ..... ) LastWeek
on .....
where Lastweek... is null
union
Select
table1,table2
getdate() as Date,
LastWeek.table1, lastweek.table2
(
SELECT...
FROM ....
....
FROM....)
)ThisWeek
Right outer join
(
SELECT table1, table 2 ....
FROM ....
where...
FROM ....] ) - 2)
) LastWeek
on ....
where ... is null
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
