0

I am trying to insert using this syntax:

INSERT  INTO salon_vendor_purchase_products(invoice_num, product_id, quantity, price) SET (\'65786\', 1, 1, 700), (\'65786\', 2, 1, 900), (\'65786\', 3, 1, 1700)

But keep getting the following error:

sqlMessage: 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near \'SET (\'65786\', 1, 1, 700), (\'65786\', 2, 1, 900), (\'65786\', 3, 1, 1700)\' at line 1',
1

1 Answer 1

2

We use set to update the table or alter the table. To put value use this:

INSERT  INTO salon_vendor_purchase_products values(65786, 1, 1, 700) ; 
INSERT  INTO salon_vendor_purchase_products values(65786, 2, 1, 900);
INSERT  INTO salon_vendor_purchase_products values(65786, 3, 1, 1700);

Just for further information

Suppose you want to modify(Update) the price of the product id 1 from 700 to 750; In this case you have to use the keyword set which is counter part of Update. The query is as follows:

UPDATE salon_vendor_purchase_products
SET price= 750
WHERE product_id = 1;
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.