Query which deals with comparision of 2 or more records of a table
<p>I want to compare 2 or more rows in sql. </p>

<p>I have a table <code>ABC</code>. It has primary key column <code>id</code>. It has 2 more columns, <code>id2</code> and <code>startdate</code>.</p>

<p>I want to find all those <code>id</code>s whose <code>startdate</code> is different from that of <code>id2</code>. <code>id2</code> is just an extension of id. </p>

<p>For eg: if <code>id</code> is <code>123</code>, then <code>id2</code> is <code>123-1</code>.</p>

<p><strong>UPDATE: Example according to OP's comment</strong></p>

<p>If table has </p>

<pre>
id      id2   startdate 
123-1   123   0408 
123           0408 
124           0508 
124-1   124   0608 
</pre>

<p>the query should display </p>

<pre>
id      id2   startdate 
124           0508 
124-1   124   0608 
</pre>

<p>where startdate is different.</p>