如何在Room中删除一个查询中的两个表?我已经尝试过了,但是没有用。 Room不允许使用此类查询。
@Query("DELETE (DELETE FROM expense_table) AND (DELETE FROM income_table)")
void deleteAllData();
答案 0 :(得分:0)
您可以使用交易 https://developer.android.com/reference/android/arch/persistence/room/Transaction.html
@Transaction
public void deleteTwo(TableEx table, TableIn table_in) {
// Anything inside this method runs in a single transaction.
delete(table);
delete(table_in);
}