Pregunta

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?

¿Fue útil?

Solución

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);

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top