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;
答案 0 :(得分:3)
将SELECT LastName
更改为SELECT C.LastName
。
CUSTOMER
和ARTIST
表都有一个LastName
列。您所指的是两个LastName
列中的哪一个,目前尚不清楚,因此“ LastName
列不明确”。
通过在表别名C
前面加上前缀,您指定要从LastName
表中的CUSTOMERS
列 。