根據多個字段查詢重複數據的總條數: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