Get an ID from another table

hi, I’m looking around and I think I’m search with the wrong keywords… So, here I’m…
How do I get the last insert ID after I use a executeSql method in my factory?
I tried some stuff like RETURNING id but didn’t work.
I’m doing something like this:

db.transaction( function(tx){ 
tx.executeSql('INSERT OR REPLACE INTO table (name) VALUES (?)', [name]);