if (( $(git rev-list $1..$2|wc -l) == 0 )); then echo "$2 is ancestor of $1"
elif (( $(git rev-list $2..$1|wc -l) == 0 )); then echo "$1 is ancestor of $2"
else echo "$1 and $2 are unrelated"
fi
Вы можете сделать это с помощью оператора CASE:
update the_table
set the_column = case pk_column
when 1 then (select the_column from the_table where pk_column = 2)
when 2 then (select the_column from the_table where pk_column = 1)
end
where pk_column in (1,2);
Выше предполагается, что pk_column
определено как уникальное.