sql – 使用子查询插入多行

前端之家收集整理的这篇文章主要介绍了sql – 使用子查询插入多行前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
这是查询
INSERT INTO qualification_lookup (variation,correct_qualification)
SELECT (SELECT Qualification FROM student WHERE Qualification like 'A%'),'A-Level'

这是我尝试执行查询时得到的错误.

Msg 512,Level 16,State 1,Line 1 Subquery returned more than 1 value. This is not permitted when the subquery follows =,!=,<,<=,>,>= or when the subquery is used as an expression. The statement has been terminated.

如果有人告诉我任何替代方法,我是sql新手.

解决方法

INSERT INTO qualification_lookup (variation,correct_qualification) 
select Qualification,'A-Level' from student   where Qualification like 'A%'
原文链接:https://www.f2er.com/mssql/79264.html

猜你在找的MsSQL相关文章