我想根据以下规则选择数据并添加一个名为“检查”的新列:
我已经创建了代码,但非常非常慢,因为这是示例数据,所以只是想知道有人可以帮忙吗? 谢谢
我已经创建了代码,但是非常非常慢,因为这是示例数据
case
when Master_Consumer is null then
case when Bill_group = 'Consumer'
then Consumer_scope
else Customer_scope -- ??
end
when
min(case when Master_Consumer = Consumer and Consumer_scope = 'Out of scope' then 1 end)
over (partition by Master_Consumer) = 1
or Product like '%For Dairy%'
then 'Out of scope'
else Consumer_scope -- ??
end