title: Compare rows and columns of same table
body: <pre><code>+--------------+--------------+------------+
  | company_name | address_type |  address   |
  +--------------+--------------+------------+
  | Company A    | Billing      | 111 Street |
  | Company A    | Shipping     | 111 Street |
  | Company B    | Billing      | 222 Street |
  | Company B    | Shipping     | 333 street |
  | Company B    | Shipping     | 444 street |
  +--------------+--------------+------------+
  </code></pre>
  
  <p>I have a table similar to this.<br>
  What i need is <strong>All the companies whose billing address and shipping address are different</strong>. </p>
  
  <p>NOTE - Each company has only ONE billing address. But it can have multiple Shipping addresses</p>
  
  <p>This seems like a fairly simple query but I'm not just able to get it.</p>
  
  <p>My attempt - I tried 'subtracting' all the shipping address from Billing but there's just no output. 
  Distinct doesn't help as well</p>
  
  <p>Query:</p>
  
  <pre><code>select company_name 
  from tableA 
  where address_type='Billing' 
  and company_name not in (select to_char(company_name) from tableA where address_type='Shipping');
  </code></pre>
  
  <p>Output should be <strong>Company B</strong> (since it's billing and shipping address is different)</p>
  
  <p>EDIT 1 : Tried Indra's query but it runs forever. No response</p>
  
  <pre><code>select A.* from company A inner join company B on A.company_Name = B.company_Name
  and (A.address_type = 'Billing' and B.address_type = 'Shipping') 
  AND A.address &lt;&gt; B.address 
  </code></pre>