MySQL:错误 1054 (42S22):“where 子句”中的未知列
我正在对 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您尚未指定 ebdurls 是什么,请将 from 语句添加到您的查询中:
编辑:
比尔是对的,现在已经修复了格式。哎呀。
You haven't specified what ebdurls is, add a from statement to your query:
edit:
Bill was right, have fixed the format now. Oops.
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 ...