SQLServever中相关重复的数据查询
book_title 是ntext的所以需要转换
1.统计重复的数据的条数
select cast(book_title as varchar(8000)) ,count(*) from wap_xwdz group by cast(book_title as varchar(8000)) having count(*)>1
2.查找不包含最后一条的重复数据
select cast(book_title as varchar(8000)) from wap_xwdz where id not in (
select max(id) from wap_xwdz group by cast(book_title as varchar(8000))
) order by cast(book_title as varchar(8000))