user999377
user999377

Reputation: 71

oracle full join ambiguous column

it's very confusing

i made up 3 queries like this:

select 1 id from dual  ---- this is f1
select 2 id from dual ----- this is f2
select 3 id from dual ----- this is f3

then tried to join them together

when i did a query like

select count(id) from f1 full join f2 on f1.id=f2.id ==== error because of ambiguous column id

but the below query works

select count(id) from f1 
full join f2 on f1.id=f2.id 
full join f3 on f1.id=f2.id or f2.id=f3.id 

then the below query won't work because of the ambiguous column id

select count(id) from f1 
full join f2 on f1.id=f2.id 
full join f3 on f1.id=f2.id

can any one tell why the "or f2.id=f3.id" will not cause the ambiguous column id error?

Upvotes: 2

Views: 183

Answers (1)

Pavel Gatnar
Pavel Gatnar

Reputation: 4053

The error is in COUNT(ID), there is the table alias missing.

Upvotes: 1

Related Questions