2 Replies Latest reply: Nov 19, 2012 11:16 AM by Ankit Ashok Aggarwal RSS

    select statement

    849776
      Good morning experts,

      Can any one please help out convert one row into multiplw rows with same id
      My data is looks like this:
      
      SELECT 1 id,
             TRUNC (SYSDATE) A,
             TRUNC (SYSDATE) - 1 B,
             TRUNC (SYSDATE) - 2 C,
             TRUNC (SYSDATE) - 3 D
        FROM DUAL;
        
      
      My result should be :
        
      SELECT 1 id, 'A' employee, TRUNC (SYSDATE) start_date FROM DUAL
      UNION ALL
      SELECT 1 id, 'B'  , TRUNC (SYSDATE - 1)   FROM DUAL
      UNION ALL
      SELECT 1 id, 'C' , TRUNC (SYSDATE - 2)   FROM DUAL
      UNION ALL
      SELECT 1 id, 'D'  , TRUNC (SYSDATE - 3)   FROM DUAL
      Thanks in advance