title: Inner Join on a SQL table
body: <p>I got the following TICKET table:</p>
  
  <pre><code>DELIVERY_CODE,
  TICKET_ID,
  TIME_SMTP
  </code></pre>
  
  <p>The Delivery code has <code>5 values (100001,100002,100003,100004,100005)</code></p>
  
  <p>I want to find out which ticket_id's have not been delivered with DELIVERY_CODE 100002 but had previously <code>DELIVERY_CODE 1000001</code>. All the ticket_id's have been delivered initally with <code>DELIVERY_CODE: 100001</code></p>
  
  <p>So I should make a inner join on the table like this?</p>
  
  <pre><code>SELECT (SELECT *
  FROM TICKET A
  WHERE DELIVERY_CODE =  '1000001')
  FROM TICKET
  LEFT JOIN (SELECT *
             FROM TICKET B
             WHERE DELIVERY_CODE =  '1000002')
      ON A.TICKET_ID = B.TICKET_ID
  WHERE B.TICKET_ID IS NULL`
  </code></pre>