streetparade
streetparade

Reputation: 32878

Updating multiple values in MySQL

How can I update multiple values in MySQL?

This didn't work:

UPDATE test SET list=0,
price= 0.00 cprice= 0.00 WHERE test.id =3232

Upvotes: 28

Views: 89054

Answers (3)

northpole
northpole

Reputation: 10346

You need to put a comma between the two different values, for example:

UPDATE orders 
   SET listPrice = 0,
       bloggerPrice = 0.00,
       customerPrice = 0.00 
WHERE orders.id =245745

Upvotes: 66

Greg
Greg

Reputation: 321588

You're missing a comma:

UPDATE orders SET 
    listPrice = 0, 
    bloggerPrice = 0.00, 
    customerPrice = 0.00 
WHERE 
    orders.id = 245745

Upvotes: 10

James
James

Reputation: 82096

Try:

UPDATE orders 
SET listprice=0, bloggerPrice=0.00, customerPrice=0.00 
WHERE id=245745

Upvotes: 8

Related Questions