我正在使用rawquery()来执行内部连接,但这并没有给我任何错误并且无法正常工作,如果我直接使用此查询进入sqlite浏览器而不是这个工作但是在应用程序中此查询不起作用,是我的代码,对不起英语沟通不好
public void deleteFifo() {
final String MY_QUERY1 = "Delete from Items where res_id in (select _id from Favourite where _id not in (select _id from Favourite order by date desc limit 50))";
final String MY_QUERY2 = "Delete from Favourite where _id not in (select _id from Favourite order by date desc limit 50)";
db.rawQuery(MY_QUERY1, null);
db.rawQuery(MY_QUERY2, null);
}
答案 0 :(得分:1)
尝试:
db.delete(TableName, whereCondition, null);
即。在你的情况下
db.delete("Items", "res_id in (select _id from Favourite where
_id not in (select _id from Favourite order by date desc limit 50))", null);
和
db.delete("Favourite ","_id not in (select _id from Favourite
order by date desc limit 50)");
希望它有所帮助!!