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

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

rpppsulh1#

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

相关问题