gpt4 book ai didi

MYSQL 错误 1060 - 重复列

转载 作者:行者123 更新时间:2023-11-29 22:33:07 25 4
gpt4 key购买 nike

如何避免出现错误 1060?

CREATE VIEW `new-query` AS

SELECT L1.Inv_Num, L1.Line_Num, P1.Prod_SKU, P1.Prod_Descript,
L2.Line_Num, P2.Prod_SKU, P2.Prod_Descript, P1.Brand_ID

FROM LGLINE L1, LGLINE L2, LGPRODUCT P1, LGPRODUCT P2

WHERE P1.Prod_Category IN ('SEALER') AND P2.Prod_Category IN ('TOP COAT');

最佳答案

您指定了两次相同的列名,因此您需要将列名别名为唯一名称。我刚刚将 l1_、l2_ p1_ 和 p2_ 添加到多次出现的列中。

CREATE VIEW new-query AS
SELECT L1.Inv_Num, L1.Line_Num l1_line num, P1.Prod_SKU p1_prod_sku, P1.Prod_Descript p1_prod_descript, L2.Line_Num l2_line num, P2.Prod_SKU p2_prod_sku, P2.Prod_Descript p2_prod_descript, P1.Brand_ID
FROM LGLINE L1, LGLINE L2, LGPRODUCT P1, LGPRODUCT P2
WHERE P1.Prod_Category IN ('SEALER') AND P2.Prod_Category IN ('TOP COAT');

关于MYSQL 错误 1060 - 重复列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29664840/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com