我有以下表格:PostgreSQL的 - 列引用「庫Id」不明確
A(StudentID, Name, Years)
B(Age, LibraryID)
C(Years, Grade, LibraryID)
這是我的代碼讓我煩惱的部分:
c1 cursor for select LibraryID, Age, Grade, Name from A,B,C where b.LibraryID = c.LibraryID and c.Years=a.Years;
我收到以下錯誤:
column reference "LibraryID" is ambiguous
嘗試添加的事實每個LibraryID的不同別名 – mfgabriel92
也爲LibraryID在select子句中添加別名前綴,如下所示:'c1 cursor for select b.LibraryID,Age,Grade,Name from A,B,C where b.LibraryID = c.LibraryID and c.Years = a.Years;' – Harsh
@Harsh我不明白爲什麼會出現這種情況。當我們從A,B,C出發,並不是ABC表共同使用它們的共同屬性?然後從那張新表中抽出LibraryID,年齡和年級? – Brandon