Sql语句: 1  select distinct ename,job,sal,to_char(hiredate,'yyyy"年"mm"月"dd"日 开始入场"') from emp
 2* order by sal desc,hiredate asc显示结果:ENAME      JOB              SAL TO_CHAR(HIREDATE,'YYYY"
---------- --------- ---------- -----------------------
                                2010年07月27日 开始入场
KING       PRESIDENT       5000 1981年11月17日 开始入场
FORD       ANALYST         3000 1981年12月03日 开始入场
SCOTT      ANALYST         3000 1987年04月19日 开始入场
JONES      MANAGER         2975 1981年04月02日 开始入场
BLAKE      MANAGER         2850 1981年05月01日 开始入场
CLARK      MANAGER         2450 1981年06月09日 开始入场
ALLEN      SALESMAN        1600 1981年02月20日 开始入场
TURNER     SALESMAN        1500 1981年09月08日 开始入场
MILLER     CLERK           1300 1982年01月23日 开始入场
WARD       SALESMAN        1250 1981年02月22日 开始入场
MARTIN     SALESMAN        1250 1981年09月28日 开始入场
ADAMS      CLERK           1100 1987年05月23日 开始入场
JAMES      CLERK            950 1981年12月03日 开始入场
SMITH      CLERK            800 1980年12月17日 开始入场已选择15行。为什么显示结果的第一行为当前的提日期 ??  怎么才能将它消除掉!!!!
谢了!!

解决方案 »

  1.   

    to_char(hiredate,'yyyy"年"mm"月"dd"日 开始入场"') as FinalHireDate
      

  2.   

    我试过了在plsql和sqlplus都没错啊 都是14行
      

  3.   

    还有个问题就是 加上那个 distinct 貌似 就不能执行 
    显示错误:  1  select distinct ename,job,sal,to_char(hiredate,'yyyy"年"mm"月"dd"日 开始入场"') from emp
      2* order by sal desc,hiredate asc
      3  /
    order by sal desc,hiredate asc
                      *
    ERROR 位于第 2 行:
    ORA-01791: 不是 SELECTed 表达式
    这是怎么回事啊???
      

  4.   

    还有你的这个语句应该是会报错的吧select distinct ename,job,sal,to_char(hiredate,'yyyy"年"mm"月"dd"日 开始入场"') hiredate from emp order by sal desc,hiredate asc