mysql - Find duplicates in database based on two records -


i have database fields following:

id -- user id -- role id  1  --- 100 ----- 119 2  --- 100 ----- 119 3  --- 101 ----- 101 4  --- 102 ----- 250 5  --- 103 ----- 300 

i'd able feed in list of user ids, , have return role id's duplicated. example, sample above, print out following:

100 --- 119 --- 2 

i'd query able delete these duplicates well, after run select see results

select user_id, role_id, count() user_roles user_id in () group user_id, role_id having count() > 1;


Comments

Popular posts from this blog

gcc - MinGW's ld cannot perform PE operations on non PE output file -

How to connect android app to App engine -

hadoop - Running Map Reduce Job shows error - Mkdirs failed to create /var/folders/ -