title: How can I subtract one column value from another when duplicating rows?
body: <p>I am looking for some help to try and workout how I can subtract values from 2 columns and then use the result as the new value for one of them. After this I would like to duplicate the columns as I would like the 2 column values to be on separate rows and one of the values on each row to be changed to 0.</p>
  <p>The following is an example of what I am trying to do:</p>
  <p>CREATE TABLE SCRIPT</p>
  <pre><code>CREATE TABLE CONNECT_BY_LVL_EXAMPLE_2 (
    EMPLOYEE_ID VARCHAR2(9 BYTE),
    WORKING_TIME_MINS NUMBER,
    TRAVEL_TIME_MINS NUMBER,
    UNIQUE_JOB_NO VARCHAR2(34 BYTE)
    );
  
  INSERT INTO CONNECT_BY_LVL_EXAMPLE_2 VALUES
    ('123456789',73,62,'VP25');
  </code></pre>
  <p>This then gives me the following:</p>
  <pre><code>| EMPLOYEE_ID | WORKING_TIME_MINS | TRAVEL_TIME_MINS | UNIQUE_JOB_NO |
  | 123456789   | 73                | 62               | VP25          |
  </code></pre>
  <p>I have managed to write the code that will duplicate the rows as I would like the WORKING_TIME_MINS and TRAVEL_TIME_MINS to be on separate rows.</p>
  <pre><code>SELECT * FROM CONNECT_BY_LVL_EXAMPLE_2,
      ( 
      SELECT ROWNUM SEQ FROM DUAL CONNECT BY LEVEL &lt;= 2
      )
  WHERE
      ( TRAVEL_TIME_MINS &gt; 0 OR SEQ = 1 )
      ;
  </code></pre>
  <p>which gives me the following output:</p>
  <pre><code>| EMPLOYEE_ID | WORKING_TIME_MINS | TRAVEL_TIME_MINS | UNIQUE_JOB_NO |
  | 123456789   | 73                | 62               | VP25          |
  | 123456789   | 73                | 62               | VP25          |
  </code></pre>
  <p>Now where I am stuck, is trying to subtract the TRAVEL_TIME_MINS from WORKING_TIME_MINS as the WORKING_TIME_MINS of 73 is including the TRAVEL_TIME_MINS and therefore should be 73 - 62 = 11 and I am not sure how I add this into the code.</p>
  <p>This the FINAL OUTPUT I am trying to achieve.</p>
  <pre><code>| EMPLOYEE_ID | WORKING_TIME_MINS | TRAVEL_TIME_MINS | UNIQUE_JOB_NO |
  | 123456789   | 11                | 0                | VP25          |
  | 123456789   | 0                 | 62               | VP25          |
  </code></pre>
  <p>Hoping someone can advise.</p>