Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any short way to add multiple items

I am adding data to table. Table looks like this:

enter image description here

I am getting multiple data from my JSP page that should be entered uniquely each time. Means in table prod_id and sc_id will remain same for this request. Suppose I am getting 3 items then I have to use 3 insert query that will pass each item one by one.

I am using JSP and sevlet for this.

So my question is that is there any unique or other way to do so using single INSERT statement?

like image 689
user3145373 ツ Avatar asked Oct 21 '22 16:10

user3145373 ツ


1 Answers

In mMSQL you can insert multiple rows in one insert command:

http://dev.mysql.com/doc/refman/5.5/en/insert.html

For example:

INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);

like image 200
Tim B Avatar answered Oct 23 '22 11:10

Tim B