SET @update_id := 0; UPDATE some_table SET row = 'value', id = (SELECT @update_id := id) WHERE some_other_row = 'blah' LIMIT 1; SELECT @update_id;