select al.*
from afcs_agent al left join afcs_agent_group ar on al.empno=ar.empno
where 1=1执行时候总是报 SQL command not properly ended ??
from afcs_agent al left join afcs_agent_group ar on al.empno=ar.empno
where 1=1执行时候总是报 SQL command not properly ended ??
from afcs_agent al,afcs_agent_group ar
where al.empno=ar.empno(+)如上就可以了
ORACLE中左右连接使用(+)就可以了,放在等式左边左连接,等式右边右连接
PS-------------------------------------------------------
外部联接"+"的用法 外部联接"+"按其在"="的左边或右边分左联接和右联接.若不带"+"运算符的表中的一个行不直接匹配于带"+"预算符的表中的任何行,则前者的行与后者中的一个空行相匹配并被返回.若二者均不带’+’,则二者中无法匹配的均被返回.利用外部联接"+",可以替代效率十分低下的 not in 运算,大大提高运行速度.例如,下面这条命令执行起来很慢 select a.empno from emp a where a.empno not in (select empno from emp1 where job=’SALE’); 倘若利用外部联接,改写命令如下: select a.empno from emp a ,emp1 b where a.empno=b.empno(+) and b.empno is null and b.job=’SALE’; 可以发现,运行速度明显提高.