Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 如何更新我的sql 5.0查询_Mysql - Fatal编程技术网

Mysql 如何更新我的sql 5.0查询

Mysql 如何更新我的sql 5.0查询,mysql,Mysql,我有以下sql查询: UPDATE table_b SET score=1, score_a = 1 WHERE id = (select id from table_a where user_id ="Ken") 我想为多个用户(如“肯”、“乔”等)更新分数和分数 有人能帮我告诉我怎么做吗?使用连接表格id到表格id UPDATE table_b JOIN table_a ON table_b.id = table_a.id SET score=1, score_a =

我有以下sql查询:

UPDATE table_b
SET score=1, score_a = 1
WHERE id = (select id from table_a where user_id ="Ken")
我想为多个用户(如“肯”、“乔”等)更新分数和分数


有人能帮我告诉我怎么做吗?

使用
连接
表格id
表格id

UPDATE
  table_b
  JOIN table_a ON table_b.id = table_a.id
SET 
  score=1, 
  score_a = 1
WHERE
  table_a.user_id IN('Ken','Joe','etc')

使用
JOIN
table_b.id
连接到
table_a.id

UPDATE
  table_b
  JOIN table_a ON table_b.id = table_a.id
SET 
  score=1, 
  score_a = 1
WHERE
  table_a.user_id IN('Ken','Joe','etc')