喜爱
我需要创建7个数据集(class Solution {
public:
vector<int> solutions;
vector<int> twoSum(vector<int>& nums, int target)
{
for(int i = 0; i < nums.size(); i++)
{
for(int j = i+1; j < nums.size(); i++)
{
if(nums[i] + nums[j] == target)
{
solutions.push_back(j);
solutions.push_back(i);
return solutions:
}
}
}
}
};
,local
,web
,call
,local&call
,local&web
,call&web
)取决于如果客户使用了以下样本数据中的频道,则为
all
please see this picture for more details on the sample table
因此,如果客户在一个实例中使用了所有三个渠道,而在另一个实例中他只使用了其中任何一个,那么Customer = 1的那一行应该转到&#39; all&#39;数据集。类似地,对于3,如果他在一个实例中使用了local和web而在另一个实例中只使用了web,那么它应该转到| customer | call | local | web |
|----------|------|-------|-----|
| 1 | 1 | 1 | 1 |
| 1 | | 1 | 1 |
| 1 | | 1 | |
| 2 | 1 | | 1 |
| 2 | | 1 | |
| 2 | 1 | | |
| 3 | | | 1 |
| 3 | 1 | 1 | |
数据集。
客户ID不应在其他数据集中重复,即客户1只能属于其中一个数据集。
我坚持这个,任何人都可以给我一个sas或sql代码片段以继续进行。
谢谢!
答案 0 :(得分:0)
如果所有三个都进入&#34; all&#34;,则使用聚合:
select customer,
(case when max(call) > 0 and max(local) > 0 and max(web) > 0 then 'all'
else concat_ws('&', (case when max(call) > 0 then 'call' end),
(case when max(local) > 0 then 'local' end),
(case when max(web) > 0 then 'web' end)
)
end) as grp
from t
group by customer;