我正在嘗試爲家庭作業寫一個Oracle查詢。該任務是編寫一個查詢以返回所有員工的employee_id,job_id,hire_date和department_id,第二個查詢列出job_hist表中的employee_id,job_id,start_date和department_id,並將結果組合爲單個輸出。確保你在輸出中抑制重複。FROM關鍵字找不到預期的地方ERROR
代碼,我:
SELECT employee_id AS "Employee ID", job_id AS "Job Id", TO_CHAR(NULL) hire_date "Hire Date", department_id AS "Department Id",
FROM employees
UNION
SELECT employee_id AS "Employee Id", job_id AS "Job Id", TO_CHAR(NULL) start_date "Start Date",department_id AS "Department Id",
FROM job_history;
錯誤我得到:
ORA-00923: FROM keyword not found where expected
從我可以在書中告訴,序列大致正確。任何幫助將是偉大的!除去逗號之後
代碼:
SELECT employee_id AS "Employee ID", job_id AS "Job Id", TO_CHAR(NULL) hire_date "Hire Date", department_id AS "Department Id"
FROM employees
UNION
SELECT employee_id AS "Employee Id", job_id AS "Job Id", TO_CHAR(NULL) start_date "Start Date",department_id AS "Department Id"
FROM job_history;
我只想在這裏評論。在'FROM'之前有一個額外的逗號。 – cctan 2012-03-30 01:26:46