查询表达式中存在语法错误(缺少运算符)?

发布于 2024-11-01 20:06:44 字数 344 浏览 0 评论 0原文

您好,提前感谢您的帮助。

我收到错误:“查询表达式中存在语法错误(缺少运算符)”,我不知道为什么......有什么想法吗?

这是我的查询:

 UPDATE 
table1

SET 
table1.country_name = table2.COUNTRY,
table1.city = table2.CITY ,
table1.state = table2.STATE 

FROM
 ( table1 
inner join
table2 
ON
 table2.SITE_ID = table1.SiteID )

where
table1.country_name is null;

hello and thanks in advance for any help.

I am getting an error: 'Syntax Error (missing operator) in query expression' and I do not know why... any ideas?

This is my query:

 UPDATE 
table1

SET 
table1.country_name = table2.COUNTRY,
table1.city = table2.CITY ,
table1.state = table2.STATE 

FROM
 ( table1 
inner join
table2 
ON
 table2.SITE_ID = table1.SiteID )

where
table1.country_name is null;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

擦肩而过的背影 2024-11-08 20:06:44

Access/Jet 中的 UPDATE 查询中没有 FROM 子句SQL

UPDATE table1 INNER JOIN table2 ON table1.SiteID = table2.SITE_ID
SET table1.country_name = table2.COUNTRY,
    table1.city = table2.CITY ,
    table1.state = table2.STATE 
WHERE table1.country_name is null;

There is no FROM clause in an UPDATE query in Access/Jet SQL:

UPDATE table1 INNER JOIN table2 ON table1.SiteID = table2.SITE_ID
SET table1.country_name = table2.COUNTRY,
    table1.city = table2.CITY ,
    table1.state = table2.STATE 
WHERE table1.country_name is null;
她说她爱他 2024-11-08 20:06:44

去掉连接表周围的括号。此外,我个人会为 table1 和 table2 创建一个别名,并在更新中引用 table1 别名。像这样:

UPDATE t1
SET 
  t1.country_name = t2.COUNTRY,
  t1.city = t2.CITY,
  t1.state = t2.STATE 
FROM table1 t1 
INNER JOIN table2 t2 ON t2.SITE_ID = t1.SiteID
WHERE
  t1.country_name is null;

Lose the parenthesis around the joined tables. In addition I would personally make an alias for table1 and table2 and reference the table1 alias in the update. Like this:

UPDATE t1
SET 
  t1.country_name = t2.COUNTRY,
  t1.city = t2.CITY,
  t1.state = t2.STATE 
FROM table1 t1 
INNER JOIN table2 t2 ON t2.SITE_ID = t1.SiteID
WHERE
  t1.country_name is null;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文