When i run the following query i get an error like “Column ‘manager_id’ in where clause is ambiguous” how to resolve it.
select * from employee
join leave_details on leave_details.employee_id=employee.id
inner join manager on (manager.id=leave_details.manager_id)
where manager_id=4;
I am using this query to display the leave details of a particular employee whose manager_id is xxx.
This message means manager_id column exists in more than one table you’ve put into your FROM section. Prefix field name with the table name (e.g. “employee.manager_id” if you mean employee) – even when it is not necessary, it’s a good practice.