2012-12-22 62 views
3

我想在MySQL中執行查詢,但不起作用。這是查詢:更新查詢在mySQL中不起作用

Update chambre set nombre_lit = 5 and prix = 10000 where code_ch = 2 

如果我執行這個腳本它的工作原理:

Update chambre set prix = 10000 where code_ch = 2 
Update chambre set nombre_lit = 5 where code_ch = 2 

但我想只用一條線。

回答

3

使用COMMA,如果你有多個列更新,而不是AND

UPDATE chambre 
SET nombre_lit = 5, 
     prix = 10000 
WHERE code_ch = 2 
1

試試這個: -

Update chambre set nombre_lit = 5 , prix = 10000 where code_ch = 2