I have a table called "clientes" and another one called "phones", both of them have a column "_modificado" which have a timestamp, I use a function to get the last modified item to compare with my api and then update it.
how can I use the same function to retrieve the results of the 2 tables?
function getLastSyncClientes(param) {
db.transaction(
function (tx) {
var sql = "SELECT MAX(_modificado) as lastS FROM clientes";
tx.executeSql(sql, [],
function (tx, results) {
var lastSync = results.rows.item(0).lastS;
param(lastSync);
log('Last local timestamp is ' + lastSync);
}
);
},
txErrorHandler,
function () {
}
);
}
Compute the maximum for each table, then combine them:
SELECT MAX((SELECT MAX(_modification) FROM clientes),
(SELECT MAX(_modification) FROM phones )) AS lastS