Say I have a table with 3 columns A, B, C. I want a result set which denotes those entries which have multiple/duplicate entries for either A OR B but unique entries for C.
I know the GROUP BY clause would come handy in this case, but it seems more involved than that.
For example: Say, a table having customer info with the following columns: 1)ID 2)Phone 3)Email 4)Account
Obtain those IDs which have multiple occurrences of either same Phone OR Email but belonging to different accounts. For instance, for the following entries in the original table:
1) ID: 12 | Phone: 111-111-1111 | Email: [email protected] | Account: 2
2) ID: 14 | Phone: 111-111-1111 | Email: [email protected] | Account: 5
3) ID: 15 | Phone: 123-234-7890 | Email: [email protected] | Account: 12
4) ID: 21 | Phone: 900-893-4563 | Email: [email protected] | Account: 23
5) ID: 17 | Phone: 222-333-1111 | Email: [email protected] | Account: 3
6) ID: 19 | Phone: 222-333-1111 | Email: [email protected] | Account: 3
The Resulting row(s) would be as follows:
1)IDs: 12, 14 | Accounts: 2, 5
2)IDs: 15, 21 | Accounts: 12, 23
Entries #5 and #6 were NOT included because account values not different, albeit phone and email are same.
Thanks in advance!