我有2个表:table1和table1_details(id是PK和table1.id = table1_details.id)。我编写了多个DELETE sql来删除相关记录:
delete a, b from table1 a, table1_details b where a.id=9 or b.t1_id =9
但是它没有删除记录。 (table1有一条记录,其中id = 9,table1_details没有记录,其中id = 9)
出什么问题了?
答案 0 :(得分:1)
我写错了格式。应该是
delete a, b from table1 a left JOIN table1_details b on a.id=b.t1_id where a.id=9
答案 1 :(得分:1)
Date expiry = null;
String val = token.nextToken();
if(!val.equals("null"))
{
expiry = new Date(val);;
}
Boolean isSecure = new Boolean(token.nextToken()).booleanValue();
运行此查询,它将从两个表中删除