错误1052:字段列表中的“lastname”列不明确

brc7rcf0  于 2021-06-18  发布在  Mysql
关注(0)|答案(1)|浏览(215)
CREATE VIEW CustomerInterestsView AS
    SELECT LastName AS CustomerLastName,
            C.FirstName AS CustomerFirstName,
            A.LastName AS ArtistName
    FROM
        CUSTOMER AS C
            JOIN
        CUSTOMER_ARTIST_INT AS CAI ON C.CustomerID = CAI.CustomerID
            JOIN
        ARTIST AS A ON CAI.ArtistID = A.ArtistID;
rpppsulh

rpppsulh1#

改变 SELECT LastNameSELECT C.LastName .
两个 CUSTOMER 以及 ARTIST 表有一个 LastName 列。不清楚这两个是哪一个 LastName 您所指的列,因此 LastName 列不明确”。
在它前面加上表别名 C ,您指定要 LastNameCUSTOMERS table。

相关问题