sql 查询哪些字段重复及(in和exict的区别)
select count(1),content_id,keyword_id from tb_content_keyword_relation group by content_id,keyword_id having count(1)>1 order by count(1) desc
SELECT id FROM tb_bds_sys_user WHERE del_flag = '0' AND id IN ( SELECT user_id FROM tb_bds_sys_user_role WHERE role_id = ( SELECT id FROM tb_bds_sys_role WHERE enname = 'KHJL' ) UNION SELECT user_id FROM tb_bds_user_role_data WHERE role_id = ( SELECT id FROM tb_bds_sys_role WHERE enname = 'KHJL' ) ) SELECT c.id FROM tb_bds_sys_user c WHERE EXISTS( select user_id from ( SELECT user_id FROM tb_bds_sys_user_role WHERE role_id = ( SELECT id FROM tb_bds_sys_role WHERE enname = 'KHJL' ) UNION SELECT user_id FROM tb_bds_user_role_data WHERE role_id = ( SELECT id FROM tb_bds_sys_role WHERE enname = 'KHJL') ) ur where ur.USER_ID = c.id ) and c.del_flag = '0'