我正在尝试尝试以下MySQL查询,但在xampp中不起作用

时间:2019-06-29 17:02:06

标签: mysql xampp

UPDATE `asset_form` SET `ASSIGN_TO` = ('Nishant Sourav') 
WHERE asset_form.ASSIGN_TO = ('Nishant Sourav ') LIMIT 50

1 个答案:

答案 0 :(得分:0)

问题在于限制条款`。 以下工作在sqlfiddle中只是很好的测试 创建插入和更新必须在左侧

CREATE TABLE asset_form
(`ID` int NOT NULL AUTO_INCREMENT 
 , `buyer` int
 , `seller` int
 , `ASSIGN_TO` varchar(60),
PRIMARY KEY (ID))
;

INSERT INTO asset_form
( `buyer`, `seller`, `ASSIGN_TO` )
VALUES
( 22, 12, 'test'),
( 500, 20, 'Nishant SouravÂ')
;

UPDATE asset_form
SET `ASSIGN_TO`='Nishant Sourav' 
WHERE `ASSIGN_TO` IN (
SELECT `ASSIGN_TO` FROM (
SELECT `ASSIGN_TO` From asset_form
    ORDER BY `ASSIGN_TO` ASC  
  Limit 0,1
) tmp
);
) tmp
);

在正确的视线范围内

  Select * From asset_form;