我正在尝试从另一个表更新数据库表的一列。
但总是得到同样的错误:
我发现一篇帖子谈到了错误1064,但没有帮助我。
我尝试过这些代码:
UPDATE A
SET A.pageviews = B.cntaccess
FROM wp_popularpostsdata A INNER JOIN wp_top_ten B ON A.postid = B.postnumber
UPDATE a
SET a.pageviews = b.cntaccess
FROM wp_popularpostsdata a JOIN wp_top_ten b ON a.postid = b.postnumber
UPDATE T1
SET T1.pageviews = T2.cntaccess
FROM wp_popularpostsdata T1 INNER JOIN wp_top_ten T2 ON T1.postid = T2.postnumber
WHERE 1;
请帮帮我吗?
答案 0 :(得分:0)
我认为您正在使用MySQL,根据查询中的更正:
UPDATE wp_popularpostsdata A
JOIN wp_top_ten B ON A.postid = B.postnumber
SET A.pageviews = B.cntaccess
UPDATE wp_popularpostsdata a
JOIN wp_top_ten b ON a.postid = b.postnumber
SET a.pageviews = b.cntaccess
UPDATE wp_popularpostsdata T1
JOIN wp_top_ten T2 ON T1.postid = T2.postnumber
SET T1.pageviews = T2.cntaccess
WHERE 1;
对于常规更新加入:
<强> 1。 MYSQL 强>
UPDATE TABLEA a
JOIN TABLEB b ON a.join_colA = b.join_colB
SET a.columnToUpdate = [something]
2.SQL SERVER或MSSSQL
UPDATE A
SET foo = B.bar
FROM TableA A
JOIN TableB B
ON A.col1 = B.colx
WHERE ...
答案 1 :(得分:0)
UPDATE wp_popularpostsdata A INNER JOIN wp_top_ten B ON A.postid = B.postnumber
SET A.pageviews = B.cntaccess
UPDATE wp_popularpostsdata a JOIN wp_top_ten b ON a.postid = b.postnumber
SET a.pageviews = b.cntaccess
UPDATE wp_popularpostsdata T1 INNER JOIN wp_top_ten T2 ON T1.postid = T2.postnumber
SET T1.pageviews = T2.cntaccess
WHERE 1;