查詢oracle數據庫是否有重複數據(根據多個字段判斷)

根據多個字段查詢重複數據的總條數:python

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
相關文章
相關標籤/搜索