首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > oracle >

duplicate column name解决办法

2012-08-29 
duplicate column nameselect e.empno,e.deptno,e.ename,d.ename from emp e,emp d where e.mgrd.empno a

duplicate column name
select e.empno,e.deptno,e.ename,d.ename from emp e,emp d where e.mgr=d.empno and e.hiredate<d.hiredate;

  EMPNO DEPTNO ENAME ENAME
---------- ---------- ---------- ----------
  7499 30 ALLEN BLAKE
  7521 30 WARD BLAKE
  7698 30 BLAKE KING
  7566 20 JONES KING
  7782 10 CLARK KING
  7369 20 SMITH FORD

6 rows selected.

SQL> create table empa as select e.empno,e.deptno,e.ename,d.ename from emp e,emp d where e.mgr=d.empno and e.hiredate<d.hiredate;
create table empa as select e.empno,e.deptno,e.ename,d.ename from emp e,emp d where e.mgr=d.empno and e.hiredate<d.hiredate
  *
ERROR at line 1:
ORA-00957: duplicate column name

[解决办法]
提示比较明显了,就是列名重复。
如楼主的做法,起不同的别名就OK了

热点排行