我有一个名为bobcarenewvm__vm25-183的虚拟机。我要备份此虚拟机并附加到另一个虚拟机。我只能将磁盘快照(包含此虚拟机)附加到另一个虚拟机。
问题是在某些情况下磁盘可能包含多个虚拟机。如何备份到特定虚拟机。我尝试备份磁盘的代码如下。
select *
from
(
select
c.company, m.id, m.code, m.company as setting_company,
row_number() over (partition by c.company, m.code
order by case when m.company = '***' then 2 else 1 end) as rnk
from (select distinct company from mytable where company <> '***') c
left join mytable m on m.company = c.company or m.company = '***'
) results
where rnk = 1
order by company, code;