我想从“商店”获取与传递的StoreName相对应的ID。
Select ID from Stores WHERE Name='Megamart'
现在我希望将此id插入表中。 我这样做了:
INSERT INTO NetOrderID ( StoreID, SalesManID) VALUES ( " Select ID from Stores WHERE Name='Megamart'" , 1)
但事实证明这不起作用。救命!
答案 0 :(得分:2)
INSERT INTO NetOrderID ( StoreID, SalesManID)
Select ID, 1 from Stores WHERE Name='Megamart'