1、
SELECT * from Ex_PlanPerson
where isconfirm <>1 AND plan_id=12 AND user_id in (select user_id from Ex_PlanPerson WHERE plan_id=12 group by user_id having count(user_id) > 1)
and id not in (select min(id) from Ex_PlanPerson WHERE plan_id=12 group by user_id having count(user_id)>1)
ORDER BY real_name
SELECT * from Task_Questionnaire
where tq_tasid = 70 And tq_uid in (select tq_uid from Task_Questionnaire WHERE tq_tasid = 70 group by tq_tmxh,tq_uid having count(tq_tmxh) > 1)
and tq_id not in (select min(tq_id) from Task_Questionnaire WHERE tq_tasid = 70 group by tq_tmxh having count(tq_tmxh)>1)
ORDER BY tq_uid
-----删除代码-----
DELETE from Task_Questionnaire
where tq_tasid = 70 And tq_uid in (select tq_uid from Task_Questionnaire WHERE tq_tasid = 70 group by tq_tmxh,tq_uid having count(tq_tmxh) > 1)
and tq_id not in (select min(tq_id) from Task_Questionnaire WHERE tq_tasid = 70 group by tq_tmxh having count(tq_tmxh)>1)