Finding duplicate rows based on value in different column
<p>I've this table with the following data:</p>

<pre><code>CaseID|ProductNr|CodeNr|Test
    1 |1234     |444   |No
    1 |1235     |444   |No
    1 |1236     |444   |No
    1 |1237     |666   |No
    1 |1238     |777   |No
    2 |1244     |555   |No
    2 |1245     |555   |No
</code></pre>

<p>I want a query that find all the "ProductNr" that has the same "CodeNr" within the same "CaseID".</p>

<p>E.g. if <code>.. Where CaseId = 1</code> the result should be as below:</p>

<pre><code>CaseID|ProductNr|CodeNr|Test
    1 |1234     |444   |No
    1 |1235     |444   |No
    1 |1236     |444   |No
</code></pre>

<p>I'm using sql server</p>

<p>It should be possible to change the CaseId value.. The CaseId value should be a parameter.. because the query need to be a part af stored procedure..</p>