两个表的数据大概都在100W  表A 和表B  排重要根据3个字段 a,b,c这三个字段都相同才排重a表中的

解决方案 »

  1.   

    贴建表及插入记录的SQL,及要求结果出来看看
      

  2.   

    python:
    SELECT1="select a,b,c from A";
    cur.execute(SELECT1)
    result1=cur.fetchall()
    SELECT2="select * from B where a=%s and b=%s and c=%c"
    cur.execut(SELECT2,result1)
    result2=cur.execute(SELECT2)
    if result2 != ():
       DELETE="delete * from B where a=%s and b=%s and c=%c"
       cur.execute(DELETE,result1)
      

  3.   

    delete from a where exists (select 1 from b where a=a.a and b=a.b and c=a.c);或者delete a from a inner join b on a.a=b.a and a.b=b.b and a.c=b.c;不过需要有索引(a,b,c)