This discussion is archived
2 Replies Latest reply: Nov 19, 2012 9:16 AM by AnkitAshokAggarwal RSS

select statement

849776 Explorer
Currently Being Moderated
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

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points