matching attributes in two columns
Hello,
I need help constructing an SQL query to find matching data in a table across two columns (Oracle 11g, but this is so basic I suspect the exact brand of SQL doesn't matter).
I have a large table with a PK of 'ModuleItemID', a 'ModuleNumber' column matching to a lookup table, and a 'PartNo' column. A single ModuleNumber can be associated with many PartNo's, but each PartNo should only appear with each ModuleNumber once.
I need to root out several instances of the above - "find all ModuleItemID rows with a particular ModuleNumber and PartNo where count >1" - but I'm not sure what the exact syntax is.
In the example below, I want to find duplicate rows like 1 & 3 and 7 & 9:
<code>
ModuleItemID ModuleNumber PartNo
1 1 161-4514
2 1 168-0056
3 1 161-4514
4 2 160-4514
5 2 168-0056
6 3 160-4514
7 3 171-0023
8 3 181-0565
9 3 171-0023
</code>
Thanks for any advice!
Last edited by Nostromo77; June 21st, 2011 at 04:20 PM..
Reason: edited to fix tabular data
|