Use el LAST_INSERT_ID() función: update table whatever set product_id = id where id = last_insert_id()