问题描述
我需要为标题道歉.我想了很多,但没有走得太远.
我有一张看起来像这样的表格:
按计数升序排序.
我想用相应的 pricelevelid 更新所有 00000000-0000-0000-0000-000000000000 的 pricexxxxid.
例如 accountid = 36B077D4-E765-4C70-BE18-2ECA871420D3 我希望 pricexxxxid 为 F43C47CE-28C6-42E2-8399-92C58ED4BA9D.>
完成后,我希望删除 accountid = 36B077D4-E765-4C70-BE18-2ECA871420D3 之后的所有记录.
换句话说,我最终会得到一个不同的 accountid 列表,其中 pricexxxxid 将被分配到 pricelevelid 中的相应值.
非常感谢您的指导.
对于你的第一个案例!
如果我正确理解你的第二种情况:(删除重复项/选择不同的)?
已编辑
更新
I need to apologize for the title. I put a lot of thought into it but didn't get too far.
I have a table that looks like this:
It is sorted by ascending counts.
I would like to update the pricexxxxids that are all 00000000-0000-0000-0000-000000000000 with their corresponding pricelevelid.
For example for accountid = 36B077D4-E765-4C70-BE18-2ECA871420D3 I would like the pricexxxxid to be F43C47CE-28C6-42E2-8399-92C58ED4BA9D.
After that is done, I would like all the records FOLLOWING this one where accountid = 36B077D4-E765-4C70-BE18-2ECA871420D3 to be deleted.
Another words in result I will end up with a distinct list of accountids with pricexxxxid to be assigned with the corresponding value from pricelevelid.
Thank you so much for your guidance.
for your first case do !
if i understand your second case correctly :(delete duplicates/select distinct)?
edited
updated
这篇关于我是否需要递归 CTE 来更新依赖于自身的表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!