What I want is if the result is empty, if both tables are empty I want to insert something into the database. The problem is with the current SQL-string
It should probably be something different than “SELECT * FROM incomplete, complete”
But what?
database.transaction(function(transaction){
transaction.executeSql('SELECT * FROM incomplete, complete;', [], function(transaction, results) {
var resultLength = results.rows.length;
if(resultLength == 0) {
transaction.executeSql('INSERT INTO complete (todo, description, date) VALUES (?, ?, ?);', ['Do Something', 'Description', date]);
}
});
});
Assuming standard SQL is allowed, you can execute the following statement:
This only works if the structure of both tables is the same. And it is not a very efficient way to check whether data is in both tables.