title: Finding matching columns values based upon hostname
body: <p>I have a table <code>table1</code> with <code>b_id</code> as <code>PK</code>,  <code>ip</code>, <code>host</code>
  In this table different hosts can have the same ipaddress
  Here, <code>t2_id</code> is foreign key to <code>id</code> of <code>table2</code> </p>
  
  <pre><code>b_id    ip              host             t2_id
  9205    10.10.10.10     zero             1121
  9206    10.10.10.10     hello.abc.com    1121
  9207    10.10.10.10     hi.abc.com       1121
  </code></pre>
  
  <p>I have another table <code>table2</code> <code>id</code> as <code>PK</code>,  <code>ip</code>, <code>host</code> and <code>b_id</code> Here <code>b_id</code> is Foreign key to <code>table1</code>
  In my project, two hostname <code>hi.abc.com</code> and <code>hi</code> are considered as same because the domain name <code>abc.com</code> is not considered in comparison. So, I just need to compare the <code>hostname without domain name</code></p>
  
  <pre><code>id      ip              host             b_id
  1121    10.10.10.10     hi               null
  </code></pre>
  
  <p>I want to filter out rows from <code>table1</code> which have same <code>ip</code> values but the <code>host</code> is different
  So, my output should be</p>
  
  <pre><code>b_id    ip              host             t2_id
  9205    10.10.10.10     zero             1121
  9206    10.10.10.10     hello.abc.com    1121
  </code></pre>
  
  <p>I have written following query but it is not giving correct result</p>
  
  <pre><code>select * from table1 T1 INNER JOIN table2 T2
  ON T1.t2_id = T2.id
  where T1.host not like T2.host;
  </code></pre>