gpt4 book ai didi

mysql - #1064 - 你的 SQL 语法有错误...靠近 FROM

转载 作者:行者123 更新时间:2023-11-29 20:47:42 26 4
gpt4 key购买 nike

我对 MySQL 很陌生,但在遇到这个障碍之前已经取得了一些成功。任何帮助将不胜感激。

我正在尝试根据表 2 中的匹配列更新表 1。MySQL 版本是 5.5。这是 2 个表(对相似的表/列名称表示歉意,应该事先计划好列命名):

表 1 - 域

+--------+------------------------------------------+----------------+-----------+
| ID | DomainKeyword | GoogleSearches | GoogleCPC |
+--------+------------------------------------------+----------------+-----------+
| 406499 | 1k commandments | NULL | NULL |
| 406500 | 1k feet deep | NULL | NULL |
| 406501 | 1 market square | NULL | NULL |
| 406502 | 1marketst 3012 | NULL | NULL |
| 406503 | 1 massive cashflow | NULL | NULL |
| 406504 | 1 min tv | NULL | NULL |
| 406505 | 1 minutes tv | NULL | NULL |
| 406506 | 1 minutes tv | NULL | NULL |
| 406507 | 1 money mentor | NULL | NULL |
| 406508 | 1 my bia2 music | NULL | NULL |
| 406509 | 1n4j8 | NULL | NULL |

表 2 - google 搜索

+------+----------------------------------+----------+-------+
| ID | Keyword | Searches | CPC |
+------+----------------------------------+----------+-------+
| 3330 | audio buss | 480 | 0.00 |
| 3331 | balls to poverty | 30 | 0.00 |
| 3332 | boa homes | 10 | 0.00 |
| 3333 | bath construction | 10 | 0.00 |
| 3334 | bread crumbs catering | 10 | 0.00 |
| 3335 | complete recruit | 90 | 0.00 |
| 3336 | all about carpets | 10 | 0.00 |
| 3337 | consulting world | 10 | 0.00 |
| 3338 | car insurance loans | 50 | 3.64 |
| 3339 | building experts | 50 | 0.00 |
| 3340 | boyfriend jealousy | 30 | 0.00 |
| 3341 | avid farm shop | 30 | 0.00 |
| 3342 | chic bridesmaid | 10 | 0.00 |
| 3343 | ad wholesale | 10 | 0.00 |
| 3344 | buy game card | 10 | 0.00 |
| 3345 | daily driving | 10 | 0.00 |
| 3346 | church farm cottage | 260 | 1.18 |

这是命令,似乎我使用“FROM”运行的某些命令会引发相同的错误:

UPDATE dest
SET GoogleSearches = src.Searches,
GoogleCPC = src.CPC
FROM domains AS dest
INNER JOIN googlesearches AS src
ON dest.DomainKeyword = src.Keyword;

尝试运行命令时遇到的错误:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM domains AS dest INNER JOIN googlesearches AS src ON dest.DomainKeyword = ' at line 4

最佳答案

试试这个:反转你的查询...我认为它在 mysql 中比在 sql server 中反转:

UPDATE domains AS dest
INNER JOIN googlesearches AS src ON dest.DomainKeyword = src.Keyword
SET dest.GoogleSearches = src.Searches,
dest.GoogleCPC = src.CPC;

关于mysql - #1064 - 你的 SQL 语法有错误...靠近 FROM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38333645/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com