7.3.12

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

No comments:

Post a Comment