![](/img/trans.png)
[英]MySQL: SELECT * FROM table1, table2… column1 AS newColumnName
[英]How to put values from one table to another WHERE column1 of table1 = column2 of table2?
我的表1和表2都有兩列
ID
得分
我想為MySQL 5.5的查詢,讓我更新score
我的table2
究竟在哪兒id
的table1
= id
的table2
,其中id
= 1。
換句話說,當查詢在任何發生的行中運行時,我想要一個sql在其中使兩個表中的特定id的分數相同,該行中的score字段必須相同,但不是所有的id,只是id等於1。
你是這個意思嗎?
UPDATE table2 t2
SET score = (SELECT score from table1 WHERE id = 1)
WHERE id = 1
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.