标题第一种 :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
;
来源地址:https://blog.csdn.net/qq_40098750/article/details/129295331