pull the next query from the last insert