Hi,
You must check your two or more tables have column name EmpId,so you must use alias for each table and access with alias name.
Please refer below sql script
DECLARE @temp1 AS TABLE(EmpId INT,Name VARCHAR(10))
DECLARE @temp2 AS TABLE(EmpId INT,Salary INT)
INSERT INTO @temp1 VALUES(1,'David')
INSERT INTO @temp1 VALUES(2,'Jhon')
INSERT INTO @temp1 VALUES(3,'Kevin')
INSERT INTO @temp1 VALUES(4,'Peter')
INSERT INTO @temp2 VALUES(1,10000)
INSERT INTO @temp2 VALUES(2,11111)
INSERT INTO @temp2 VALUES(3,12222)
-- it will give error Ambiguous column name 'EmpId'
SELECT EmpId,Name,Salary FROM @temp1 t1
INNER JOIN @temp2 t2 ON t1.EmpId = t2.EmpId
-- it will be executed successfully.
SELECT t1.EmpId,Name,Salary FROM @temp1 t1
INNER JOIN @temp2 t2 ON t1.EmpId = t2.EmpId
I hope this will help you out.