Above query will give us error as:-
Msg 209, Level 16, State 1, Line 1
Ambiguous column name 'Created_Date'.
Ambiguous column mean in above query we have specified created_date twice in select list and also provided alias name for table 'Employee_Master'.And also Table is searching for 2 Created_Date columns.That's why it's showing as Ambiguous column name.
So,to overcome this problem,we must specify alias name.column name as:-
Select e.created_date,* From Employee_Master e order by Emp_Id,e.Created_Date;
Select created_date,* From Employee_Master e order by Emp_Id,e.Created_Date;
Now,above query will work.
Asked In: Many Interviews |