Updating two tables in a single query in sql