insert into tbl_orderdetails (package_expiry,package_mocktest, package_section_test, package_video, order_id, package_name, status,orderdetail_date)
values (
( select package_exp from tbl_package where package_name = get_package_name),
( select package_mocktest_count from tbl_package where package_name = get_package_name),
( select package_section_count from tbl_package where package_name = get_package_name),
( select package_video_count from tbl_package where package_name = get_package_name),
@orderId, get_package_name, 1, NOW());
从一张桌子中选择了这么多,有没有替代方案呢? 非常感谢你的努力,并给了我一些宝贵的时间来改善我。抱歉,英语不好。
答案 0 :(得分:1)
我怀疑你应该使用insert select这样的东西
insert into tbl_orderdetails
(package_expiry,package_mocktest, package_section_test, package_video, order_id, package_name, status,orderdetail_date)
select package_exp ,
package_mocktest_count,
package_section_count,
package_video_count ,
@orderId, get_package_name, 1, NOW())
from tbl_package where package_name = get_package_name