How to in Room delete two tables in one Query? I've tried this, but it doesn't work. Room does not allow the use of such a query.
@Query("DELETE (DELETE FROM expense_table) AND (DELETE FROM income_table)")
void deleteAllData();
You could use transaction https://developer.android.com/reference/androidx/room/Transaction
@Transaction
public void deleteTwo(TableEx table, TableIn table_in) {
// Anything inside this method runs in a single transaction.
delete(table);
delete(table_in);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.