SELECT emp. email_01 as online_id,
emp. email_02 as primary_id,
dept. email_03 as secondary_id
from
(select distinct
emp. email_01 as online_id,
emp. email_02 as primary_id,
dept. email_03 as secondary_id
from emp, dept
where emp.id=dept.id)
答案 0 :(得分:0)
在这种情况下,您不需要有子查询:
SELECT DISTINCT
emp.email_01 AS online_id,
emp.email_02 AS primary_id,
dept.email_03 AS secondary_id
FROM emp
INNER JOIN dept
ON ( emp.id=dept.id )
您还可以使用ANSI连接语法而不是(令人困惑的)旧版Oracle逗号连接语法。