我正在尝试做类似
的事情INSERT INTO tbl_order_detail (key_order,key_product,fld_unit_price,fld_quantity)
VALUES (<value1>, <value2>,
SELECT fld_unit_price,fld_quantity FROM tbl_product WHERE key_product = <value2>);
这个的正确语法是什么?
答案 0 :(得分:5)
INSERT INTO tbl_order_detail
(key_order,key_product,fld_unit_price,fld_quantity)
SELECT <value1>, <value2>, fld_unit_price,fld_quantity
FROM tbl_product
WHERE key_product = <value2>;
答案 1 :(得分:1)
INSERT
INTO tbl_order_detail
(
key_order,
key_product,
fld_unit_price,
fld_quantity
)
SELECT
<value1>,
<value2>,
fld_unit_price,
fld_quantity
FROM tbl_product
WHERE key_product = <value2>
;