select work_num,p_id,count(*) 总数量,count(*)-1 重复数量from table_namegroup by work_num,p_id 如果不重复不要显示的话再加一句having count(*)>=2