1、排除 name =a 且 age=23的用户
where not
SELECT * FROM users WHERE NOT (name='a' AND age=23);
2、截止当前累计数
sum() over (order by sdate)
select
下单数
,sum(用户数) over () k
,sum(用户数) over (order by 下单数) k2
from (
select 下单数,count(*) 用户数 from (
select user_pin,count(*) 下单数 from xa_ods_t_order_union
where created_at>='2023-01-01 00:00:00' group by user_pin
) u group by 下单数
) p
;