Mysql Select rows with same values in one column and different in another
I'd really appreciate it if someone could validate my SQL query. For the following dataset: MD5 UserPK CategoryPK ADCDE 1 7 ADCDE 1 4 ADCDE 1 7 dffrf 1 7 dffrf 2 7 dffrf 2 6 dffrf 1 1 I'd like to select MD5 and CategoryPK where two or more rows exist with identical MD5 values, identical CatgegoryPK and two or more DIFFERENT UserPK values. In other words, I'd like to know the MD5 and categoryPK of all records where two or more different users (UserPK) have assigned the same category (UserPK) to the same file (Md5). I'm not interested in records the same user has assigned the category to