mysql - 错误提示“错误代码:1242。子查询返回超过 1 行”
问题描述
我正在尝试插入表,这是我的多对多关系的第三个表,称为“许可证”。我已将插入语句写入存储过程。
我想将 id 是外键的客户和产品表的主键插入到第三个表许可证中,我编写了如下插入语句:
insert into customer`.`tbl_license`(LicenseKey,Quantity,CustomerId,ProductId,Discount)
values((select UUID()),quantity,
(select AutoID from customer.tbl_customer where
CustomerName=customername),
(select AutoID from customer.tbl_product where
ProductName=productname),discount);
这个插入语句正确吗?我在插入语句中写了查询
解决方案
推荐阅读
- python - 如何使用 ffmpeg 在 python 中检查视频损坏?
- sql - 无法使用名为 Ataccama 的数据治理工具调用雪花程序
- ssas - MDX:排除共享度量的相同维度属性的成员
- angular - FormsModule:添加到对象,仅当值存在时
- vba - Access vba 运行缓慢
- java - 如何从 Java 中的另一个 aws lambda 调用 aws lambda 函数?
- sql - 从动态 sql 字符串变量中选择 INTO Temp 表
- javascript - 如何同时过滤和映射数组?
- r - 您可以按行和列排列 Flexdashboard 吗?
- excel - 我需要在 Excel 中计算项目的进度百分比