I am trying to create a query for my table but I get error. I have two tables in the database called 'assignment' and my two tables are 'emp' and 'dept'.
SELECT EMP.EMPNO, EMP.ENAME, EMP.SAL, DEPT.DNAME
FROM assignment.EMP, assignment.DEPT
INNER JOIN EMP on EMP.DEPTNO=DEPT.DEPTNO
WHERE EMP.SAL > 1000
AND DEPT.DNAME="SALES" LIMIT 0, 25
MySQL said: Documentation
#1066 - Not unique table/alias: 'EMP'
CodePudding user response:
Fixed your JOIN.
SELECT EMP.EMPNO, EMP.ENAME, EMP.SAL, DEPT.DNAME
FROM assignment.DEPT INNER JOIN assignment.EMP ON EMP.DEPTNO = DEPT.DEPTNO
WHERE EMP.SAL > 1000 AND DEPT.DNAME = "SALES" LIMIT 0, 25