MySQL Forums
Forum List  »  Newbie

insert into table
Posted by: scott andreas
Date: February 14, 2018 12:54PM

Hello

I have a table that has a a nitems with varchar (8) as its definition. What I need is to use an insert into a xdoc table that will produce a number of inserts based on the data in nitems.

example: lets say nitems has a value of 10. in the xdoc table to produce new inserts statements with 10 different insert values for each of the column defined

INSERT INTO docx(item,id,path,...)
VALUES (item1,id,user/1,...),
(item2,id,user/2,...),
(item3,id,user/3,...),
(item4,id,user/4,...),
(item5,id,user/5,...),
(item6,id,user/6,...),
(item7,id,user/7,...),
(item8,id,user/8,...),
(item9,id,user/9,...),
(item10,id,user/10,...);


tried with select into and insert with select statements but just cannot figure this out


thank you in advance

Options: ReplyQuote


Subject
Written By
Posted
insert into table
February 14, 2018 12:54PM
February 14, 2018 02:23PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.