group by 和 distinct 的问题select a.partner as pcode, count(distinct(a.deviceid)) as count -- into num4 from test a where a.activationtime >= to_date('2011-4-17', 'yyyy-mm-dd') and a.activationtime < to_date(

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/29 06:10:40
group by 和 distinct 的问题select a.partner as pcode, count(distinct(a.deviceid)) as count         -- into num4           from test a          where a.activationtime >= to_date('2011-4-17', 'yyyy-mm-dd')            and a.activationtime < to_date(

group by 和 distinct 的问题select a.partner as pcode, count(distinct(a.deviceid)) as count -- into num4 from test a where a.activationtime >= to_date('2011-4-17', 'yyyy-mm-dd') and a.activationtime < to_date(
group by 和 distinct 的问题
select a.partner as pcode, count(distinct(a.deviceid)) as count
-- into num4
from test a
where a.activationtime >= to_date('2011-4-17', 'yyyy-mm-dd')
and a.activationtime < to_date('2011-4-17', 'yyyy-mm-dd') + 1
and a.type = 2
and a.status = 1
group by a.partner
我想得到总数 ,可是.用group bu 不要的话 在统计的时候
就不会distinct 我想去除重复 然后得到结果
而且我还要分组

group by 和 distinct 的问题select a.partner as pcode, count(distinct(a.deviceid)) as count -- into num4 from test a where a.activationtime >= to_date('2011-4-17', 'yyyy-mm-dd') and a.activationtime < to_date(
select a.partner as pcode,count(1) as count
-- into num4
from test a
where a.activationtime >= to_date('2011-4-17','yyyy-mm-dd')
and a.activationtime < to_date('2011-4-17','yyyy-mm-dd') + 1
and a.type = 2
and a.status = 1
group by a.partner
正常的count()就可以了啊