If you are executing SELECT statement in Sybase IQ with
having same alias name of two columns as below
SELECT
School.cCreatedBy AS CreatedBy,
Student.cCreatedBy AS CreatedBy,
Student.FullName AS FullName
FROM
School INNER JOIN Student
ON
School.ID = Student.SchoolID
then you will get error “Alias 'CreatedBy'
is not unique”.
However same query run in SQL Server without any
problem.
To fix this just remove alias or change alias name of
any one column as below
SELECT
School.cCreatedBy,
Student.cCreatedBy,
Student.FullName AS FullName
FROM
School INNER JOIN Student
ON
School.ID = Student.SchoolID
OR
SELECT
School.cCreatedBy AS SchoolCreatedBy,
Student.cCreatedBy AS CreatedBy,
Student.FullName AS FullName
FROM
School INNER JOIN Student
ON
School.ID = Student.SchoolID
Please leave your comments or share this tip if it’s
useful for you.
No comments:
Post a Comment