如何同时从多个表中删除数据SQLITE,ionic2
我在sqlite中有两个表,ionic2user\u master,user\u packages我试图同时删除两个表中的所有数据,即在单个sql语句中。 我能从一张桌子上清除,但不知道如何从另一张桌子上清除如何同时从多个表中删除数据SQLITE,ionic2,sqlite,ionic2,Sqlite,Ionic2,我在sqlite中有两个表,ionic2user\u master,user\u packages我试图同时删除两个表中的所有数据,即在单个sql语句中。 我能从一张桌子上清除,但不知道如何从另一张桌子上清除 deleteAllTablesSqlite() { this.db.openDatabase({//create table user_packages and store data in it name: 'cbsapp.db', location
deleteAllTablesSqlite() {
this.db.openDatabase({//create table user_packages and store data in it
name: 'cbsapp.db',
location: 'default' // the location field is required
}).then(() => {
this.db.executeSql('DELETE from user_master', {}).then(() => {
this.db.vacuum;
console.log('TABLE deleted');
}, (err:any) => {
console.error('Unable to execute sql: ', err);
});
}, (err: any) => {
console.error('Unable to open database: ', err);
});//end then
};//end deleteAllTablesSqlite()
请引导我
1-是否有任何方法可以在sqlite、ionic2中删除这两个表
2-如何在单个sql调用或循环中清空两个表
谢谢你想要哪一个DROP(这将删除不存在的表)或DELETE(这将删除行但保留对象)?首选DROP,我尝试在存在user\U master、user\U软件包时删除表,但不起作用。我只能在一个db.executeSql语句中删除一个表