select a.* from td a where exists(select 1 from td where tid=a.tid and tmoney=a.tmoney and mid!=a.mid)
解决方案 »
- 2003 SP2系统安装SQL2008企业版出现人品级问题。 蛋碎一地,大牛救救我
- 求助:SQL中关于大文本类型的数据,如音频、视屏如何处理?
- Access链接服务器与txt链接服务器同时访问,冲突
- 数据库的数据同步的问题!
- SQL server 2000支不支持on delete cascade
- varchar转换为binary后再转换回来为什么就不一样了??
- SQL Server2000拷贝粘贴数据为什么不能全部过来?
- sql的全文检索技术?
- 我的SQL SERVER在删除和修改数据时老提示"键列信息不足或不正确,更新影响到过多的行",怎么解决?
- SQL SERVER的字符串处理
- 请教一条SQL语句
- 如何壓縮數據庫空間!很急!!!請高手幫忙!!
insert into @t select 'm01','t01',20
insert into @t select 'm02','t02',30
insert into @t select 'm03','t03',50
insert into @t select 'm04','t01',20select
a.mid
from
@t a
where
exists(select 1 from @t where tid=a.tid and tmoney=a.tmoney and mid!=a.mid)/*
mid
---
m01
m04
*/
=td.tmoney)t
declare @t table(mid varchar(50),tid varchar(50),tmoney decimal)
insert into @t select 'm01','t01',20
insert into @t select 'm02','t02',30
insert into @t select 'm03','t03',50
insert into @t select 'm04','t01',20
select * from @t where tid in(select tid from @t group by tid having count(*)>1)
from tb b,(select tid,tmoney from tb group by tid,tmoney having count(*) >1 )a
whee a.tid=b.tid and a.tmoney=b.tmoney