我们使用配置单元对AB测试数据运行查询。这里的问题是我们有一些我们试图忽略的重复数据。幸运的是,我们有办法忽略重复数据。我们的conversion_meta列包含此重复数据的指示符。
我想找distinct (conversion_meta, conversion_type)
。我不能真正弄清楚正确的语法。以下是我到目前为止的情况:
select conversion_type, day, sum(if(is_control='true', 1, 0)) as Control,
sum(if(is_control='false', 1, 0)) as Test from Actions
where day > "2013-12-20" and experiment_key='xyz' group by conversion_type, day
最终结果中的列应如下所示:
转换类型,日期,控制(计数),测试(计数)
答案 0 :(得分:0)
我认为你可以用union all解决这个问题。:
select conversion_type, day, sum(if(is_control='true', 1, 0)) as Control,
sum(if(is_control='false', 1, 0)) as Test from Actions
where day > "2013-12-20" and experiment_key='xyz' and conversion_meta = false
group by conversion_type, day
UNION ALL
select conversion_type, day, sum(if(is_control='true', 1, 0)) as Control,
sum(if(is_control='false', 1, 0)) as Test from Actions
where day > "2013-12-20" and experiment_key='xyz' and conversion_meta = true
group by conversion_type, day