Reputation: 468
I've spent loads of time searching around trying to figure this out but I can find a solution.
I'm trying to return the total row count in my database
Here is what I do to pull all the genre of a specific type.
var film_list = tx.executeSql('SELECT * FROM mydb WHERE genre = "Comedy"');
how can I do something like
var film_total = tx.executeSql('SELECT * FROM mydb TOTAL_ROW_COUNT "');
console.log(film_total)
Upvotes: 0
Views: 2267
Reputation: 1443
var totalRowCount = 0;
var genres = new Array("Comedy","Horror","Romantic","Action","Thriller","Indy");
for(var i = 0; i < genres.length; i++){
var cmdString ="SELECT COUNT(*) FROM mydb WHERE genre = '";
cmdString.concat(genres[i];
var genreCount = tx.executeSql(cmdString);
totalRowCount += genreCount;
}
Upvotes: 1
Reputation: 5722
You'll have to iterate through each table, and add up the individual counts.
SELECT Count(*) FROM TableName
Upvotes: 2