Insert Into with multiple columns and multiple values in SQL

Viewed 893
INSERT INTO MANAGING(SUPID, EMPID)
VALUES (76, 1, 4, 8);

currently this is the code I have, I just simply want to have the 1,4,8 go into the EMPID as three separate values.

Any help would be great, thanks!

3 Answers

Insert them using separate scripts.

Simply try this.

INSERT INTO MANAGING(SUPID, EMPID) VALUES (76, 1);
INSERT INTO MANAGING(SUPID, EMPID) VALUES (76, 4);
INSERT INTO MANAGING(SUPID, EMPID) VALUES (76, 8);

Depending on your db engine, you can do it also using

INSERT INTO MANAGING(SUPID, EMPID) VALUES (76, 1),(76, 4),(76, 8);

if you have emp table

INSERT INTO MANAGINS(SUPID,EMPID) SELECT 76, ID FROM EMP_TABLE
Related