Ambiguity issue on column in SQL

Database
The Teradata Database channel includes discussions around advanced Teradata features such as high-performance parallel database technology, the optimizer, mixed workload management solutions, and other related technologies.
Highlighted
Enthusiast

Ambiguity issue on column in SQL

I am getting a error that "<column> is ambiguous"

 

The same sql has been running fine in past runs and suddenly it start giving this ambiguity error.

 

I am loading a volatile table using below query and column org is coming from two tables and it is used in where condition without any alias but in past this was running fine and suddenly it start throwing ambiguity error, can someone explain why? 

Note- Org column existed in both the tables in past runs also but at that time it ran fine.

 

Select

Empno

from employee e

 

inner join dept d

on e.dept_no = d.dept_no

 

where org = 'DELL'

 

1 REPLY
Senior Apprentice

Re: Ambiguity issue on column in SQL

Hi,

 

Using your example below, if both Employee and Dept contain a column called 'org' then your code below is correctly failing.

 

If it used to work but now does not then clearly something has changed, you need to work out what. Possibilities that I can think of:

1) Software upgrade which corrected a bug. If multiple tables in a query contain the same named column then you have to provide a table alias/identifier when referring to the column.

2) An underlying view definition has changed such that they now both contain the same named column - 'Org'.

 

HTH

Dave

Ward Analytics Ltd - information in motion
www: http://www.ward-analytics.com