Alias name cannot match another table/alias name in FROM Clause
Teradata Teradata Discussion Forums Teradata.com Discussion Forum
Visit Teradata.com
Home       Guidelines    Member List
Welcome Guest ( Login | Register )
        


This online forum is for user-to-user discussions of Teradata products, and is not an official customer support channel for Teradata. If you require direct assistance, please contact Teradata support.


Alias name cannot match another table/alias... Expand / Collapse
Author
Message
Posted 6/3/2008 11:09:11 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 6/16/2008 11:49:56 AM
Posts: 17, Visits: 68
Hello all,
Actually I'm trying to perform the following request and I receive this error :

Error 3870: Alias name cannot match another table/alias name in FROM clause.

select *

from table1 AS A inner join table2 AS B
ON A.field1=B.field1,
A inner join table3 AS C
ON A.field2=C.field2,
A inner join table4 AS D
ON A.field1=D.field1,
A inner join table5 AS E
ON A.field1=E.field1

where
C.DATE1 BETWEEN A.DATE2 and A.DATE2
;


As far as I can see it, each of my alias does correspond to one single table!
So why this error ?
Is it forbidden to join the same field of table 1 two times on different tables ?

Thank you very much if you find an answer.
BR
Post #11720
Posted 6/3/2008 11:35:31 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: Today @ 4:54:41 PM
Posts: 534, Visits: 285
You should be glad about that error message ;-)
Your query is an 8-table mixing SQL89 and SQL92 style joins, it would result in cross-joining the result sets of those inner joins.

You probably wanted:
from table1 AS A
, table2 AS B
, table3 AS C
, table4 AS D
, table5 AS E
WHERE A.field1=B.field1
AND A.field2=C.field2
AND A.field1=D.field1
AND A.field1=E.field1

Rewritten using JOIN syntax:
from table1 AS A inner join table2 AS B
ON A.field1=B.field1
inner join table3 AS C
ON A.field2=C.field2
inner join table4 AS D
ON A.field1=D.field1
inner join table5 AS E
ON A.field1=E.field1

Dieter
Post #11721
Posted 6/4/2008 3:56:34 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 6/16/2008 11:49:56 AM
Posts: 17, Visits: 68
Okay thank you very much, it works very fine !
Post #11726
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 ( 0 guests, 0 members, 0 anonymous members )
No members currently viewing this topic.


All times are GMT -5:00, Time now is 9:19pm

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.188. 10 queries. Compression Disabled.