title: "SELECT MAX(rowid) FROM table" query works only after "SELECT * FROM table" has been called
body: <p>The below function is in a javascript file. The intent is to return the maximum value in the rowid column of a sqlite database. Currently, it works only after a "Select * from table query" has been run. Why is this? </p>
  
  <pre><code>function lastRecord(){  
  db.transaction(function (tx) {
        tx.executeSql('SELECT MAX(rowid) as mr FROM Surveys', [], function(tx, results){
    var maxRowid = results.rows.item(0).mr;
    alert(maxRowid);
  });
  });
  } 
  </code></pre>
  
  <p>I would appreciate clarification regarding what needs to be loaded to get SELECT MAX(rowid) to show the correct MAX rowid value every time the function is called. What is the standard format (structure) for implementing the MAX function? THANKS. </p>