1 2 Previous Next 19 Replies Latest reply: Jan 25, 2013 4:53 AM by Nitesh. RSS

    Need best solution for the particular case..

    Nitesh.
      My Oracle version is 11.2

      Table name is emp ..

      Values are

      EMPNO     ENAME     JOB     MGR     HIREDATE     SAL     COMM     DEPTNO     PROJNO     LOADSEQ     REC_AMT

      8945     MILLER     CLERK     7782     1/23/1982     1300          10               
      7782     CLARK          7839     6/9/1981     2450          10          2     
      7369     SMITH     CLERK     7902     12/17/1980     800     20                    
      7499     ALLEN     SALESMAN     7698     2/20/1981     1600     300     30          5     
      7521     WARD     SALESMAN     7698     2/22/1981     1250     500     30          4     
      7566     JONES     MANAGER     7839     4/2/1981     2975          20          1     
      7654     MARTIN     SALESMAN     7698     9/28/1981     1250     1400     30          3     
      7698     BLAKE     MANAGER     7839     5/1/1981     2850          30          3     
      7788     SCOTT     ANALYST     7566     12/9/1982     3000          20               
      7839     KING     PRESIDENT          11/17/1981     5000          10               
      7844     TURNER     SALESMAN     7698     9/8/1981     1500     0     30          2     
      7876     ADAMS          7788     1/12/1983     1100          20               
      7900     JAMES          7698     12/3/1981     950          30          1     
      7902     FORD     ANALYST     7566     12/3/1981     3000          20               

      Requirement is

      I have to get an output as

      Dept no Ename

      10 MILLER,CLARK
      20 SMITH,SCOTT
      ... so on


      I am trying with pivoting .. Is it correct way to do this or any other best solution can anyone suggest me here .

      Thanks,
      Nitesh ..
        1 2 Previous Next