我正在尝试将备份从其他服务器恢复到新服务器,但我收到了此错误:
执行此查询时出错:
CREATE algorithm=undefined definer=root@localhost sql security definer VIEW resellers ASSELECT resellers1.id AS id,
(
SELECT clienttypes.id_client_type AS id_client_type
FROM clienttypes
WHERE (
clienttypes.id_client_type = 64)) AS client_type,
resellers1.idreseller AS idReseller,
resellers1.login AS login,
resellers1.password AS password,
resellers1.type AS type,
resellers1.id_tariff AS id_tariff,
resellers1.callslimit AS callsLimit,
resellers1.clientslimit AS clientsLimit,
resellers1.tech_prefix AS tech_prefix,
resellers1.identifier AS identifier,
resellers1.fullname AS Fullname,
resellers1.address AS Address,
resellers1.city AS City,
resellers1.zipcode AS ZipCode,
resellers1.country AS Country,
resellers1.phone AS Phone,
resellers1.email AS Email,
resellers1.maxclients AS MaxClients,
resellers1.template_id AS template_id,
resellers1.taxid AS TaxID,
resellers1.type2 AS type2,
resellers1.language AS language
FROM resellers1
WHERE (
NOT(
EXISTS
(
SELECT clientsshared.id_reseller AS id_reseller
FROM clientsshared
WHERE ((
clientsshared.id_tariff = -(2))
AND (
resellers1.login = clientsshared.login)
AND (
resellers1.password = clientsshared.password)))))
UNION ALL
SELECT resellers2.id AS id,
(
SELECT clienttypes.id_client_type AS id_client_type
FROM clienttypes
WHERE (
clienttypes.id_client_type = 65)) AS client_type,
resellers2.idreseller AS idReseller,
resellers2.login AS login,
resellers2.password AS password,
resellers2.type AS type,
resellers2.id_tariff AS id_tariff,
resellers2.callslimit AS callsLimit,
resellers2.clientslimit AS clientsLimit,
resellers2.tech_prefix AS tech_prefix,
resellers2.identifier AS identifier,
resellers2.fullname AS Fullname,
resellers2.address AS Address,
resellers2.city AS City,
resellers2.zipcode AS ZipCode,
resellers2.country AS Country,
resellers2.phone AS Phone,
resellers2.email AS Email,
NULL AS NULL,
resellers2.template_id AS template_id,
resellers2.taxid AS TaxID,
resellers2.type2 AS type2,
resellers2.language AS language
FROM resellers2
UNION ALL
SELECT resellers3.id AS id,
(
SELECT clienttypes.id_client_type AS id_client_type
FROM clienttypes
WHERE (
clienttypes.id_client_type = 66)) AS client_type,
NULL AS NULL,
resellers3.login AS login,
resellers3.password AS password,
resellers3.type AS type,
resellers3.id_tariff AS id_tariff,
resellers3.callslimit AS callsLimit,
resellers3.clientslimit AS clientsLimit,
resellers3.tech_prefix AS tech_prefix,
resellers3.identifier AS identifier,
resellers3.fullname AS Fullname,
resellers3.address AS Address,
resellers3.city AS City,
resellers3.zipcode AS ZipCode,
resellers3.country AS Country,
resellers3.phone AS Phone,
resellers3.email AS Email,
NULL AS NULL,
NULL AS NULL,
resellers3.taxid AS TaxID,
resellers3.type2 AS type2,
resellers3.language AS language
FROM resellers3;
服务器已返回此错误消息:
重复列名'NULL'
MySQL错误。
任何想法是什么问题以及如何解决它?
答案 0 :(得分:0)
在您的SQL语句中,您有三次NULL AS NULL
,这是不正确的。
where (clienttypes.id_client_type = 66)) AS client_type,NULL AS NULL,resellers3.login AS login
Email AS Email,NULL AS NULL,NULL AS NULL,resellers3.TaxID AS TaxID
有几个问题。 NULL不可能是列名,您不能使用相同的别名定义多个列。