I've this table with the following data:
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
I want a query that find all the "ProductNr" that has the same "CodeNr" within the same "CaseID".
E.g. if .. Where CaseId = 1
the result should be as below:
CaseID|ProductNr|CodeNr|Test
1 |1234 |444 |No
1 |1235 |444 |No
1 |1236 |444 |No
I'm using sql server
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..