-2
dbo.confirmend_Orders 
EmpID (FK) | Client (FK) | StartDate | EndDate | **LocationID (FK) | POCID (FK)**

在我的 .aspx 页面中,我有用于 EmpId、clientID 的控件以将它们插入上表,但没有用于 LocationID 和 POCID。

如何从其他表中获取 LocationID 和 POCID 的值并将它们插入到表 dbo.ConfirmEnd_Orders 中?

Dbo.Contacts
Address1| Address2 | CityID (FK) | ContactID(PK)

dbo.POC
FName| Lastname | Mob1 | POCID (PK)
4

2 回答 2

0
INSERT INTO dbo.confirmend_Orders (LocationId,POCID) 
SELECT locationId,POCID FROM dbo.anotherTable
于 2012-08-14T05:40:30.263 回答
0
 INSERT INTO dbo.ConfirmEnd_Orders(EmpId,clientID,LocationID,POCID)
    select  vEmpId, vclientID,t2.LocationID,t3.POCID from
    dbo.ConfirmEnd_Orders t1 inner join dbo.Contacts t2
    on t1.LocationID = t2.LocationID inner join dbo.PointOfContact t3 on t1.POCID =t3.POCID 
于 2012-08-14T05:41:57.300 回答