Insert data from other tables using select query

Here is the query to insert other tables data into the existing table in sql server
insert into AdventureWorksDW2008R2.dbo.SafetyStockLevel(productID,safetystocklevel,OrderDate) 
(
SELECT distinct p.ProductID, SafetyStockLevel,OrderDate
from dbo.Product p inner join 
dbo.SalesOrderDetail SOD 
on sod.ProductID = p.ProductID
inner join dbo.SalesOrderHeader SOH
on soh.SalesOrderID=sod.SalesOrderID
)

Cheers,
Venkatesan Prabu .J 
Head, KaaShiv InfoTech.
http://www.kaashivinfotech.com/
Ebook Download
View all
Learn
View all