Kim
Kim

Reputation: 37

Error column ambiguously defined with inner join

So I am trying to use inner join for 3 tables and I am getting the already specified error. Here is what I did:

SELECT phone 
   INTO v_phone 
FROM PEOPLE 
  INNER JOIN Family ON PEOPLE.ID=FAMILY.ID 
  INNER JOIN PETS ON FAMILY.ID=PETS.ID 
WHERE PETS.ID=:NEW.ID;

what is the issue here..

Upvotes: 0

Views: 103

Answers (1)

Grantly
Grantly

Reputation: 2556

Is PHONE from FAMILY, PEOPLE or PETS table? That is what the error is - it does not know which table to get phone from.

Ambiguous means that it cannot decide...It could be a choice of many, and it doesn't know which one to choose as it needs more information. Ambiguously defined means the field has too little information (it needs a Table Alias also)

Use PEOPLE.PHONE perhaps, depending on which phone value you need

Upvotes: 3

Related Questions