查询oracle数据库是否有重复数据(根据多个字段判断)

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

根据多个字段查询重复数据的总条数:

sql = "select count(*) from tablea a where (a.askname, a.atime) in (select askname,atime from tablea group by askname,atime having count(*)>1) and askrepid not in (select min(askrepid) from tablea group by askname,atime having count(*)>1)"
cursor.execute(sql)
conn.commit()
tables = cursor.fetchall()
print 'result*********:',tables

 

转载于:https://my.oschina.net/u/3636678/blog/2967373

你可能感兴趣的:(查询oracle数据库是否有重复数据(根据多个字段判断))