SQL查询某一字段是否是唯一值或是否有重复值


select 重复记录字段 from  数据表 group by 重复记录字段 having count(重复记录字段)>1

select user_id from table_a where ds='20220320' group by user_id having count(user_id)>1;
或
select user_id,count(*) table_a where ds='20220319' group by user_id having count(user_id) >1
SQL