我是 oracle 和 sql 的新手,我想知道如何使用 Oracle ANSI 连接条件重写以下 sql 查询。
SELECT emp_no,
(SELECT emp_title
FROM hr_v_employee
WHERE organization_code LIKE
SUBSTR (emp.depart_code, 0, 4) || '00'
AND emp_position_code =
(SELECT MIN (emp_position_code)
FROM hr_v_employee
WHERE organization_code LIKE
SUBSTR (emp.depart_code,
0,
4
)
|| '00'))
|| ' '
|| NVL (employee_deptartment, '-')
employee_deptartment
FROM employees e, employee_details o
WHERE emp.emp_no = o.emp_no(+)
编辑 1
这是我尝试过的,我的问题是是否可以使用联接或 ANSI 标准进行子查询?
SELECT emp_no,
(SELECT emp_title
FROM hr_v_employee
WHERE organization_code LIKE
SUBSTR (emp.depart_code, 0, 4) || '00'
AND emp_position_code =
(SELECT MIN (emp_position_code)
FROM hr_v_employee
WHERE organization_code LIKE
SUBSTR (emp.depart_code,
0,
4
)
|| '00'))
|| ' '
|| NVL (employee_deptartment, '-')
employee_deptartment
FROM employees e left outer join employee_details o (emp.emp_no = o.emp_no)