我创建了一个名为campaign_view
的视图。该视图由遍布众多表的信息组成(我使用六个连接)。当我尝试添加第七个连接时,我得到'错误1146:表sys.campaign_view不存在'。
我已经尝试按照建议重新启动我的服务器,但没有运气。 我试过删除视图并重新创建它。在没有遇到错误1356的情况下,我无法使用第七个连接指令重新创建。
我已经尝试使用保留字FORCE来绕过1356,但这也无法解决问题。我几乎可以肯定这很容易让我失踪。
最终我要完成的是从另一个campaign_view
视图向account_stat_summaries
视图添加三个新列。 campaign_view
中有六行,account_stat_summaries
中有三行。我希望它们基于两个表中存在的account_key
配对,我想最终得到一个包含六行的表;这应该是左连接,campaign_view
是左视图/表。
一个建议是我的左连接在其他连接之前列出(所有内部连接都是默认的),但是也没有修复它。明确列出每个联接也无法解决问题。
我已经在下面发布了我的代码,该代码成功创建了我的表,并且附加连接打破了所有内容。
原始查询(成功创建表格)
CREATE
VIEW `campaign_view` AS
SELECT
`camp`.`campaign_key` AS `ad_id`,
`a`.`modified` AS `modified`,
`a`.`fname` AS `fname`,
`a`.`lname` AS `lname`,
`a`.`account_key` AS `account_table_key`,
`s`.`status` AS `account_status`,
`a`.`account_comment` AS `account_comment`,
`a`.`platform` AS `platform`,
`a`.`details` AS `details`,
`a`.`account_claimed` AS `account_claimed`,
`a`.`pixel` AS `pixel`,
`a`.`angle` AS `angle`,
`c`.`headline` AS `headline`,
`c`.`body` AS `body`,
`c`.`link_to_graphic` AS `link_to_graphic`,
`su`.`url` AS `url`,
`su`.`site_claimed` AS `site_claimed`,
`camp`.`media_buyer` AS `media_buyer`,
`camp`.`uploader` AS `uploader`,
`a`.`created` AS `date_created`,
`v`.`name` AS `vertical`,
`camp`.`campaign_name` AS `campaign_name`,
`ads`.`adset_key` AS `adset_key`,
`ads`.`country` AS `country`
FROM
((((((`accounts` `a`
JOIN `campaigns` `camp` ON ((`camp`.`account_key` = `a`.`account_key`)))
JOIN `adsets` `ads` ON ((`ads`.`campaign_key` = `camp`.`campaign_key`)))
JOIN `content` `c` ON ((`c`.`adset_key` = `ads`.`adset_key`)))
JOIN `status` `s` ON ((`a`.`status_key` = `s`.`status_key`)))
JOIN `safe_urls` `su` ON ((`su`.`safe_url_key` = `a`.`safe_url_key`)))
JOIN `verticals` `v` ON ((`v`.`vertical_key` = `a`.`vertical_key`)))
打破一切的补充
JOIN `account_stat_summaries` `ass` ON ((`a`.`account_key` = `ass`.`account_key`)))
如果有人可以提供帮助,我将非常感激!