我有两个表: tblSupplier (唯一供应商) Columns = ID,SupplierName
tblFruit列= ID、SupplierID、价格
我有供应商的名称和价格,并且我想在tblFruit中插入行。但是如何插入ID (而不是SupplierName)呢?
我可以使用第二个查询提取我想要插入的ID,如下所示: Select ID from tblSupplier where SupplierName = ParamSupplierName...but在一个查询中必须是可能的……
提前谢谢。
发布于 2015-11-03 00:31:11
INSERT INTO tblFruit (SupplierID,Price)
SELECT ID, Price
FROM tlSupplier
WHERE SupplierName = @ParamSupplierNamehttps://stackoverflow.com/questions/33482289
复制相似问题