Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 错误代码:1054未知列';try.tb#u stores.division';在';关于第'条;_Mysql_Sql - Fatal编程技术网

Mysql 错误代码:1054未知列';try.tb#u stores.division';在';关于第'条;

Mysql 错误代码:1054未知列';try.tb#u stores.division';在';关于第'条;,mysql,sql,Mysql,Sql,早安,我试图运行此查询,但遇到了一个错误,即使该列确实存在于tb_分区中 有人能帮我解决这个错误吗: on子句中的未知列“try.tb_stores.division” --二,。存储迁移 INSERT INTO `try`.`tb_stores` ( `try`.`tb_stores`.`subscription`, `try`.`tb_stores`.`client`, `try`.`tb_stores`.`division`, `try`.`tb_stores`.`code`, `try`

早安,我试图运行此查询,但遇到了一个错误,即使该列确实存在于tb_分区中

有人能帮我解决这个错误吗:

on子句中的未知列“try.tb_stores.division”

--二,。存储迁移

INSERT INTO `try`.`tb_stores`
(
`try`.`tb_stores`.`subscription`,
`try`.`tb_stores`.`client`,
`try`.`tb_stores`.`division`,
`try`.`tb_stores`.`code`,
`try`.`tb_stores`.`name`,
`try`.`tb_stores`.`location`,
`try`.`tb_stores`.`user`,
`try`.`tb_stores`.`created_at`,
`try`.`tb_stores`.`updated_at`
)
SELECT
1,                                                                          -- subscription
`try`.`tb_clients`.`id` AS `client`,                                        -- client
`try`.`tb_divisions`.`id` AS `division`,                                    -- division
`dba_department`.`code`,                                                    -- code
`dba_department`.`descrip`,                                                 -- name
CONCAT('Region ',`dba_department`.`region_num`) AS region,                  -- location
2,                                                                          -- user
NOW(),                                                                      -- created_at
NOW()                                                                       -- updated_at
FROM `test`.`dba_department`
LEFT JOIN `try`.`tb_clients`
ON `test`.`dba_department`.`company` = `try`.`tb_clients`.`companycode`;
INSERT INTO `try`.`tb_stores`
(
`try`.`tb_stores`.`subscription`,
`try`.`tb_stores`.`client`,
`try`.`tb_stores`.`division`,
`try`.`tb_stores`.`code`,
`try`.`tb_stores`.`name`,
`try`.`tb_stores`.`location`,
`try`.`tb_stores`.`user`,
`try`.`tb_stores`.`created_at`,
`try`.`tb_stores`.`updated_at`
)
SELECT
1,                                                                          -- subscription
`try`.`tb_clients`.`id` AS `client`,                                        -- client
`try`.`tb_divisions`.`id` AS `division`,                                    -- division
`dba_department`.`code`,                                                    -- code
`dba_department`.`descrip`,                                                 -- name
CONCAT('Region ',`dba_department`.`region_num`) AS region,                  -- location
2,                                                                          -- user
NOW(),                                                                      -- created_at
NOW()                                                                       -- updated_at
FROM `test`.`dba_department`
LEFT JOIN `try`.`tb_clients`
ON `test`.`dba_department`.`company` = `try`.`tb_clients`.`companycode`
LEFT JOIN `try`.`tb_divisions`
ON `try`.`tb_stores`.`division` = `try`.`tb_divisions`.`id`;

我使用了左连接,但仍然有错误。 -- 2. 存储迁移

INSERT INTO `try`.`tb_stores`
(
`try`.`tb_stores`.`subscription`,
`try`.`tb_stores`.`client`,
`try`.`tb_stores`.`division`,
`try`.`tb_stores`.`code`,
`try`.`tb_stores`.`name`,
`try`.`tb_stores`.`location`,
`try`.`tb_stores`.`user`,
`try`.`tb_stores`.`created_at`,
`try`.`tb_stores`.`updated_at`
)
SELECT
1,                                                                          -- subscription
`try`.`tb_clients`.`id` AS `client`,                                        -- client
`try`.`tb_divisions`.`id` AS `division`,                                    -- division
`dba_department`.`code`,                                                    -- code
`dba_department`.`descrip`,                                                 -- name
CONCAT('Region ',`dba_department`.`region_num`) AS region,                  -- location
2,                                                                          -- user
NOW(),                                                                      -- created_at
NOW()                                                                       -- updated_at
FROM `test`.`dba_department`
LEFT JOIN `try`.`tb_clients`
ON `test`.`dba_department`.`company` = `try`.`tb_clients`.`companycode`;
INSERT INTO `try`.`tb_stores`
(
`try`.`tb_stores`.`subscription`,
`try`.`tb_stores`.`client`,
`try`.`tb_stores`.`division`,
`try`.`tb_stores`.`code`,
`try`.`tb_stores`.`name`,
`try`.`tb_stores`.`location`,
`try`.`tb_stores`.`user`,
`try`.`tb_stores`.`created_at`,
`try`.`tb_stores`.`updated_at`
)
SELECT
1,                                                                          -- subscription
`try`.`tb_clients`.`id` AS `client`,                                        -- client
`try`.`tb_divisions`.`id` AS `division`,                                    -- division
`dba_department`.`code`,                                                    -- code
`dba_department`.`descrip`,                                                 -- name
CONCAT('Region ',`dba_department`.`region_num`) AS region,                  -- location
2,                                                                          -- user
NOW(),                                                                      -- created_at
NOW()                                                                       -- updated_at
FROM `test`.`dba_department`
LEFT JOIN `try`.`tb_clients`
ON `test`.`dba_department`.`company` = `try`.`tb_clients`.`companycode`
LEFT JOIN `try`.`tb_divisions`
ON `try`.`tb_stores`.`division` = `try`.`tb_divisions`.`id`;

您只是在使用table department和client,而不是tb_stores,这就是您出现此错误的原因:


要么是
公司
列不存在,要么是
公司代码
列不存在,要么两者都不存在。您的查询在
加入
操作的任何部分都不使用
tb分区
。你能发布你收到的确切错误消息吗?@TimBiegeleisen对不起,我忘了输入错误。错误是“on子句”中的未知列“try.tb_stores.division”。@GiorgosBetsos即使我在tb_divisions中使用join,错误仍然是相同的。在这种情况下,您能否发布生成此错误的实际查询?