标题第一种 :distinct
select count (distinct 订单号) from dual
标题第二种:查询去重 group by
select count(订单号)aa
from
(
select 订单号 from dual
grouby 订单号
)bill
;
标题第三种: ROW_NUMBER
select sum(case when aa=1 then 订单号 else 0 end) bb
from(
select
订单号
ROW_NUMBER() OVER (PARTITION BY 订单号 ORDER BY 时间)aa
from dual)bill
;
标题第四种 union
select count(订单号 ) aa from
(
select 订单号 from dual
union
select 订单号 from dual
)bill
;
版权声明:本文为qq_40098750原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。