Suppose you have two tables TableA and TableB.
Both these table contains ID column. Now if you are trying to
access ID column as below
SELECT ID FROM TableA INNER JOIN TableB ON TableA.ID = TableB.ID
You will get Sybase IQ error Column 'Column Name' found in
more than one table -- need a correlation name.
Whenever you are using JOIN clause with more than one
table and trying to access same field name from the table then you will get this
error.
How to fix it?
Solution:-
Always make sure to use table name as prefix with
column name before accessing it as below
SELECT TableA.ID
FROM TableA INNER
JOIN TableB ON
TableA.ID =
TableB.ID
SQL SERVER generates error Ambiguous column name 'ID' for
similar condition as discussed in my another article How
to fix error Ambiguous column name 'Column Name' in SQL Server
Please leave your comments or share this tip if it’s
useful for you.
No comments:
Post a Comment