姓名 专业 收入 aa a 100 aa b 200 aa c 100select Identity(int,1,1)xh,* into #t from 表 select * from #t aa where not exists(select 1 from #t bb where aa.xh>bb.xh)OR:如果你的表中已经有唯一性的字段,可以 select * from 表 aa where not exists(select 1 from 表 bb where aa.xh>bb.xh) xh为唯一字段
select distinct 姓名 from 表 这样就可以达到你的目的啊
我要实现的是,对于一个字段,是某一个特定的字段,如有重复的内容,只取一个,对应的其他字段内容无所谓,你说的min(专业),min(收入),如果其他字段不能用max或min怎么办? ---------------------- min函数可以用在数字列、字符列和 datetime 列,但不能用于 bit 列 我想大多数情况已经适用了.------------------------------------------------ 不能解决的,你可以用临时表,方法就是:CrazyFor的那种其他的根据你的实际数据情况来处理
aa a 100
aa b 200
aa c 100select Identity(int,1,1)xh,* into #t from 表
select * from #t aa where not exists(select 1 from #t bb where aa.xh>bb.xh)OR:如果你的表中已经有唯一性的字段,可以
select * from 表 aa where not exists(select 1 from 表 bb where aa.xh>bb.xh)
xh为唯一字段
这样就可以达到你的目的啊
----------------------
min函数可以用在数字列、字符列和 datetime 列,但不能用于 bit 列
我想大多数情况已经适用了.------------------------------------------------
不能解决的,你可以用临时表,方法就是:CrazyFor的那种其他的根据你的实际数据情况来处理