网上搜索了两种删除重复行数据,感觉是第一种简洁效率更高,但是实际第二种却比较快
第一种:
select *
from (select * from biz_t_tasktrouble t where t.protype = '9') t
where rowid not in (select min(rowid)
from biz_t_tasktrouble t
where t.protype = '9'
group by t.procontent);
第二种:
select *
from biz_t_tasktrouble t
where t.procontent in (SELECT t.procontent
FROM biz_t_tasktrouble t
where t.protype = '9'
GROUP BY t.procontent
HAVING COUNT(t.procontent) > 1)
and rowid not in (select min(rowid)
from biz_t_tasktrouble t
where t.protype = '9'
group by t.procontent
having count(t.procontent) > 1)