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)