select col1,col2,col3,col4 from 表 group by col1,col2,col3,col4 having count(*)>1
解决方案 »
- SQL面试题
- 租用的sql server空间,能够防止服务器管理员修改你表的内容吗?
- 怎样实现,到了一个时间,自动更新记录
- 视图的主要作用是什么?
- 两表间若有多对关系,能否建立
- 简单问题:应该选用那种数据类型?
- SQL Server 7.0 标准版在win2000/98 下只能装client部分,server部分不能装吗?(单机情况下)
- sql server日期型的赋值问题?
- 各位大虾:在DATAGRID控件中对记录做修改时提示:键列信息不足或不正确,更新影响到更多的行
- sql数据库的一个时间类型字段与当前时间比较,要是大于等于的时候就执行某sql语句
- win98下装个人版提示安装成功,但打不开企业管理器,错误提示:MMC无法创建节点管理器,请确定MMCNDMGR.DLL已被注册
- 13亿使用电脑的中国人使用的却是3亿美国人开发的操作系统,这是每个中国人的耻辱!
FROM t
GROUP BY col1, col2, col3, col4
HAVING COUNT(*) > 1
select * from t group by 字段1,字段2,字段3,字段4 having count(*)>1
group by col1,col2,col3,col4
having count(*)>1
或:
select * from yourtabel A
where (select count(*) from yourtable
where col1 = A.col1
and col2 = A.col2
and col3 = A.col3
and col4 = A.col4 ) > 1
select 1 from 表 group by col1,col2,col3,col4 having sum(1)>1 and col1=tem.col1 and col2=tem.col2
and col3=tem.col3 and col4=tem.col4)
delete from yourtable where col1=#tmp.col1 and col2=#tmp.col2 and col3=#tmp.col3 and col4=#tmp.col4
insert into yourtable select distint * from #tmp