MySQL:错误 1054 (42S22):“where 子句”中的未知列

发布于 2024-09-11 20:41:02 字数 770 浏览 3 评论 0原文

我正在对 WordPress 数据库进行一些更改。我需要将 wp-posts 表上的 GUID 字段中的 URL 替换为来自另一个名为 ebdurls 的表的 URL。表的描述如下:

wp_posts:我需要的两个字段的字段类型是:

ID -> bigint(20) 无符号

guid -> varchar(255)

我需要导出到 wp_posts 的数据的表是这样的:

ebdurls:

title -> varchar(255)

url -> varchar(255)

ebdid -> bigint(20) unsigned

一切似乎都是正确的,但是当我应用下一个查询时,它给了我一个我真的无法得到的错误。我尝试过在任何地方引用字段、表格等,但没有成功。

mysql> update wp_posts set wp_posts.guid=ebdurls.url where wp_posts.id=ebdurls.ebdid;

ERROR 1054 (42S22): Unknown columns 'ebdurls.ebdid' in 'where Clause'

错误在哪里?

I'm doing some changes on a WordPress database. I need to replace the URLs in the GUID field on the wp-posts table with the URLs coming from another table called ebdurls. The description of the tables is as follows:

wp_posts: the field type for the two fields I need are:

ID -> bigint(20) unsigned

guid -> varchar(255)

And the table where I have the data I need to export to wp_posts is this:

ebdurls:

title -> varchar(255)

url -> varchar(255)

ebdid -> bigint(20) unsigned

Everything seems correct, but when I apply the next query it gives me an error that I really can't get. I've tried quoting fields, tables, etc... everywhere, but no luck.

mysql> update wp_posts set wp_posts.guid=ebdurls.url where wp_posts.id=ebdurls.ebdid;

ERROR 1054 (42S22): Unknown column 'ebdurls.ebdid' in 'where clause'

Where is the mistake?

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

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

发布评论

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

评论(2

终遇你 2024-09-18 20:41:02

您尚未指定 ebdurls 是什么,请将 from 语句添加到您的查询中:

UPDATE 
    wp_posts, ebdurls
SET 
    wp_posts.guid = ebdurls.url 
WHERE 
    wp_posts.id=ebdurls.ebdid;

编辑:
比尔是对的,现在已经修复了格式。哎呀。

You haven't specified what ebdurls is, add a from statement to your query:

UPDATE 
    wp_posts, ebdurls
SET 
    wp_posts.guid = ebdurls.url 
WHERE 
    wp_posts.id=ebdurls.ebdid;

edit:
Bill was right, have fixed the format now. Oops.

我是有多爱你 2024-09-18 20:41:02

ebdurls.* 没有值。这就是导致你的错误的原因。数据库不知道你想做什么。

您可能需要使用子查询或将此逻辑添加到您的应用程序中。

或者类似的东西:

更新wp_posts,ebdurls ...

ebdurls.* has no value. That is what is causing your error. The database has no idea what you are trying to do.

You probably need to use a subquery or add this logic into your application.

Or something like:

UPDATE wp_posts, ebdurls ...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文