解决Oracle ORA-01799 列不能外部连接到子查询的问题

问题描述

select * from
t_evaluate
left join act_hi_taskinst on
act_hi_taskinst.proc_inst_id_ = t_evaluate.processid

and act_hi_taskinst.start_time_ = (select max(start_time_) from act_hi_taskinst where proc_inst_id_ = t_evaluate.processid);

报错ORA-01799  外部连接的子查询,不能使用主查询的列的值

解决方法

解决方法:

select * from
t_evaluate
left join act_hi_taskinst on
act_hi_taskinst.proc_inst_id_ = t_evaluate.processid

where act_hi_taskinst.start_time_ = (select max(start_time_) from act_hi_taskinst where proc_inst_id_ = t_evaluate.processid);

不在join中使用主查询的where条件里面的子查询,可以使用主查询的列的值