- 已关闭。**此问题为not reproducible or was caused by typos。当前不接受答案。
这个问题是由打字错误或无法再重现的问题引起的。虽然类似的问题在这里可能是on-topic,但这个问题的解决方式不太可能帮助未来的读者。
1小时前关闭。
Improve this question
我正在尝试将视图导入到数据库中,执行以下操作:
create algorithm = UNDEFINED
definer = `adbo_boletines_3` @`localhost`
sql security
definer view `adbo_boletines_3`.`postcategories` as
select
`p`.`ID` as `ID`,
`p`.`post_author` as `post_author`,
`p`.`post_date` as `post_date`,
`p`.`post_date_gmt` as `post_date_gmt`,
`p`.`post_content` as `post_content`,
`p`.`post_title` as `post_title`,
`p`.`post_excerpt` as `post_excerpt`,
`p`.`post_status` as `post_status`,
`p`.`comment_status` as `comment_status`,
`p`.`ping_status` as `ping_status`,
`p`.`post_password` as `post_password`,
`p`.`post_name` as `post_name`,
`p`.`to_ping` as `to_ping`,
`p`.`pinged` as `pinged`,
`p`.`post_modified` as `post_modified`,
`p`.`post_modified_gmt` as `post_modified_gmt`,
`p`.`post_content_filtered` as `post_content_filtered`,
`p`.`post_parent` as `post_parent`,
`p`.`guid` as `guid`,
`p`.`menu_order` as `menu_order`,
`p`.`post_type` as `post_type`,
`p`.`post_mime_type` as `post_mime_type`,
`p`.`comment_count` as `comment_count`,
cast(`p`.`post_date` as date) as `fecha`,
`r`.`term_taxonomy_id` as `term_taxonomy_id`,
`t`.`parent` as `parent`,
`c`.`name` as `name`,
(
select
`cs`.`name`
from
((`wp_term_relationships` `rs`
join `wp_term_taxonomy` `ts`)
join `wp_terms` `cs`)
where
`rs`.`term_taxonomy_id` = `ts`.`term_taxonomy_id`
and `ts`.`term_id` = `cs`.`term_id`
and `ts`.`parent` = 456
and `rs`.`object_id` = `p`.`ID`
limit 1) as `pais`
from
(((`wp_posts` `p`
join `wp_term_relationships` `r`)
join `wp_term_taxonomy` `t`)
join `wp_terms` `c`)
where
`p`.`ID` = `r`.`object_id`
and `r`.`term_taxonomy_id` = `t`.`term_taxonomy_id`
and `t`.`term_id` = `c`.`term_id``term_id`;
并在执行查询后得到此错误
MySQL说:
1054-"where子句"中的"c. term_id"列未知
我真的不知道在这里做什么,或者如何修复查询以便它可以通过。
谢谢!
1条答案
按热度按时间rbl8hiat1#
最后是一个额外的文本
term_id
。可能where子句中的字段是c
。仅term_id
。也就是说,更改以下sintax:
到