--建立表結構 create table tb([name] nvarchar(10),point float)--插入測試數據 insert into tb select 'A', 60 union select 'A', 60 union select 'B', 70 union select 'B', 80 union select 'C', 80 union select 'C', 90 union select 'C', 90 union select 'D', 80 union select 'D', 80--查詢 select distinct a.[name] from tb a,tb b where a.[name]=b.[name] and a.point <> b.point--結果 /* name B C */--刪除表 drop table tb
呵呵 vivianfdlpw() 的速度快,效率高
select * from tablename t where (select 1 from tablename where 姓名=t.姓名 and 分数<>t.分数)>0
select distinct a.xm,a.fs from 表名 a,表名 where a.fs<>qq.fs and a.xm=qq.xm
create table tb([name] nvarchar(10),point float)--插入測試數據
insert into tb
select 'A', 60 union
select 'A', 60 union
select 'B', 70 union
select 'B', 80 union
select 'C', 80 union
select 'C', 90 union
select 'C', 90 union
select 'D', 80 union
select 'D', 80--查詢
select distinct a.[name]
from tb a,tb b
where a.[name]=b.[name]
and a.point <> b.point--結果
/*
name
B
C
*/--刪除表
drop table tb
vivianfdlpw() 的速度快,效率高
where (select 1 from tablename where 姓名=t.姓名 and 分数<>t.分数)>0