Umar Iqbal Umar Iqbal - 1 year ago 122
SQL Question

insert multiple rows using subquery

This is the query:

INSERT INTO qualification_lookup (variation, correct_qualification)
SELECT (SELECT Qualification FROM student WHERE Qualification like 'A%') ,'A-Level'

This is the error I get if I try to execute the query.

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.

I am new to SQL so kindly if some one tell me any alternative to do that. Thanks in advance

Kaf Kaf
Answer Source
INSERT INTO qualification_lookup (variation, correct_qualification) 
select Qualification,'A-Level' from student   where Qualification like 'A%' 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download