allan paculan
allan paculan

Reputation: 11

INSERT Select Statement

What is wrong with my following statement?

INSERT INTO studentenrolledteacher (student_id,teacher,subject) VALUES   select student_id from studentprofile WHERE lastname='marco','1','2' 

Upvotes: 1

Views: 45

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269773

You want insert . . . select. Values is not part of the syntax:

insert into studentenrolledteacher (student_id, teacher, subject)
    select student_id, 1, 2
    from studentprofile 
    where lastname = 'marco';

Upvotes: 2

Related Questions