select * from tb
where tel in(select tel from tb group by tel having count(*)>1)
where tel in(select tel from tb group by tel having count(*)>1)
解决方案 »
- 按规格分组汇总
- 重复语句问题(在线等) 刚才的未解决啊 回答的可以用直接给100哦
- 还是初学者提问
- 怎么把select a from b 显示结果作改动,把显示的0变为是,1变为否
- 如何设计貌似很多字段的表,大家帮帮忙!!!
- 在显示所有数据时,怎样把不同记录同一字段中相同的数据用其它颜色显示出来。
- sql2000,用的混合密码验证,可是windows密码我改后就启动不了
- 求SQL:把所匹配的条件也返回在结果集中.
- 如何用SQL语句添加新服务器??已知要添加的服务器的IP:192.168.0.18,用户名:sa,密码:sa.如果SQL 语句不能解决此问题,有何好办法呢??请
- 在那个网站可以下载sql server 2000?
- SQL Server 不存在或拒绝访问 错误号2147467259
- sqlserver2005标识列
insert into tb select 1 ,'张三','13579123456' union all
select 2,'李四','13579111111' union all
select 3,'李四','13579111111' union all
select 4,'王五','13579222222' union all
select 6,'赵六','13579333333' union all
select 7,'赵六','13579333333' union all
select 8,'蔡七','13579444444'
select * from tb a where [name]+code=(select [name]+code from tb where [name]+code =a.[name]+a.code group by [name]+code having count(*)>1)
drop table tb
/*
id name code
----------- ---------- -----------
2 李四 13579111111
3 李四 13579111111
6 赵六 13579333333
7 赵六 13579333333
*/
code]
我把6楼的改了一下:select * from tb a where exists(select 1 from tb where col2=a.col2 and (sn=a.sn+1 or sn+1=a.sn))这样就可以出现连续的多于的记录的结果了。
因为那些输入的人经常是连接按几次保存。
select 1 from tb where col2=a.col2 and (sn=a.sn+1 or sn+1=a.sn))
其中那个“1”是什么意思 还有这个(sn=a.sn+1 or sn+1=a.sn)指什么啊
我不太懂