搜索重复的字段?????SQL语句怎么写

loye 2004-08-04 05:52:30
在一张表里有USER字段,我要搜索重复的USER,怎样写SQL语句
...全文
144 8 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
loye 2004-08-04
  • 打赏
  • 举报
回复
OK了,谢谢各位
yesterday2000 2004-08-04
  • 打赏
  • 举报
回复
实在不行
select count(*) as xh,user into #a from tablenam group by user
select a.*
from tablename a,#a b
where a.user=b.user and b.xh>1
Explorerwen 2004-08-04
  • 打赏
  • 举报
回复
select user from (select count(*) num ,user from table group by user) where num >2
yesterday2000 2004-08-04
  • 打赏
  • 举报
回复
select * from table where user in (

select max(user) from table
group by user
having count(*)>1)
loye 2004-08-04
  • 打赏
  • 举报
回复
不行啊,我都试过了
yesterday2000 2004-08-04
  • 打赏
  • 举报
回复
select * from table where user in (

select max(user) from table
where having count(*)>1)
dqjia 2004-08-04
  • 打赏
  • 举报
回复
用count()函数
xinliangyu 2004-08-04
  • 打赏
  • 举报
回复
select * from 表名 where count(user)>1 group by user

34,838

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧