我有一个?/$request_uri
表,需要为杰克被聘用后雇用的员工显示EMPLOYEES
,EMPLOYEE_ID
,EMPLOYEE_NAME
。我有以下语法,语法错误显示:
SQL命令未正确结束。
HIREDATE
我在SELECT EMPLOYEE_ID, EMPLOYEE_NAME, HIREDATE
FROM EMPLOYEES
WHERE HIREDATE > EMPLOYEE_NAME = 'JACK';
周围尝试了(),但仍然没有工作。
答案 0 :(得分:3)
你首先必须找出杰克被雇用的时间:
SELECT HIREDATE
FROM EMPLOYEES
WHERE EMPLOYEE_NAME = 'JACK';
然后,您可以将其用作WHERE
条件的子查询。这是完成的查询:
SELECT EMPLOYEE_ID, EMPLOYEE_NAME, HIREDATE
FROM EMPLOYEES
WHERE HIREDATE > (
SELECT HIREDATE
FROM EMPLOYEES
WHERE EMPLOYEE_NAME = 'JACK'
);