日期:2014-05-17 浏览次数:20893 次
-- 查询1: 11:18:52 SCOTT@tdwora > select rownum rn, t__.* from ( 11:19:46 2 select e.deptno, e.ename, d.deptno, d.loc 11:19:46 3 from emp e, dept d 11:19:46 4 where e.deptno=d.deptno ) t__; select rownum rn, t__.* from ( * 第 1 行出现错误: ORA-00918: 未明确定义列 -- 查询2(将查询1中的子查询涉及到的两个同名字段 deptno去掉一个) 11:19:47 SCOTT@tdwora > select rownum rn, t__.* from ( 11:20:11 2 select e.deptno, e.ename, d.loc 11:20:11 3 from emp e, dept d 11:20:11 4 where e.deptno=d.deptno ) t__; RN DEPTNO ENAME LOC ---------- ---------- ---------- ------------- 1 10 KING NEW YORK 2 10 CLARK NEW YORK 3 20 FORD DALLAS 4 20 ADAMS DALLAS 5 20 JONES DALLAS 6 20 SMITH DALLAS 7 30 BLAKE CHICAGO 8 30 MARTIN CHICAGO 9 30 WARD CHICAGO 10 30 TURNER CHICAGO 11 30 ALLEN CHICAGO 已选择11行。
------解决方案--------------------
select * from users us, post pt,state se,branch bh
where us.branch_id=bh.branch_id and us.post_id=pt.post_id
and us.state_id=se.state_id
and bh.branch_name like '%'
and pt.post_name like '%'
and us.users_name like '%'
and us.users_id like '%'
你查询结果里 包含了重复的字段(标红)