0

I am using rawquery() for perform inner join, but this is not giving me any error and does not working, if i use this query directly into sqlite browser than this is working but in application this query does not work, following is my code, sorry for bad English communication

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);
}
Dipak Keshariya
  • 22,193
  • 18
  • 76
  • 128

1 Answers1

1

Try:

db.delete(TableName, whereCondition, null);

i.e. in your case

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);

and

db.delete("Favourite ","_id not in (select _id from Favourite 
order by date desc limit 50)");

Hope it helps !!

GAMA
  • 5,958
  • 14
  • 79
  • 126