我正在尝试查找特定值。如果 Region 的 Table1 的所有值都作为查找表 (Table2) 的一部分列出,则将 Table1.Region 字段替换为 value = 'ALL',基本上是尝试将所有 5 个区域分组并在全部时用“ALL”替换该值列出了 5 个区域(根据查找表中的值) 当所有区域都未列出时,保留区域代码
Year Region Value
2012 A1 24
2012 B2 24
2012 C3 24
2012 D4 24
2012 E5 24
2012 A1 36
2012 B2 36
2012 C3 36
2012 D4 36
2012 E5 36
2013 A1 24
2013 B2 24
Lookup Table
Region Value
1 A1
2 B2
3 C3
4 D4
5 E5
期望的结果
Year Region Term
2012 ALL 24 <-- Note region change to all because there are 5 regions per above
2012 ALL 36 <-- Note region change to all because there are 5 regions per above
2013 A1 24 <-- Region did not change because there were only 2 regions in source
2013 B2 24 <-- Region did not change because there were only 2 regions in source
我知道如何对数据进行分组,但分组数据需要进一步合并并替换为 ALL
感谢您的任何指导!
卡洛斯