select * from 表 group by a
解决方案 »
- 已转换的HTML文本超长无法存入字段
- 关于约束
- 大家都是如何使用帮助的,比如说有了个想法,如何更快找到需要的类、函数、存储过程等?在帮助系统中大海捞针吗?还是...
- _log日志文件太大了,怎么删除?!
- sql 企业管理器 从一个库表导入数据到另一个库的表 不重复取值
- 运行于linux或unix的应用程序是否可以访问ms SQLserver?
- 有没办法使某一个数据项触发另一项数据项
- 存储过程?(高手请进!)
- 在SQLSERVER的存储过程中能知道当前计算机的操作系统是什么吗?
- 求一关于时间分配的高效查询(sql2000)
- 简单的SQL语句,合并不同表的两列,解决马上给分!!!!!!!!
- 在线等?急啊!怎么把一个数据库的表复制到另一个数据库里面啊?
select a,max(b) b,max(c) c from aa
group by a
where b=(select min(b) from tablename where a=x.a)
into #t from tablenameselect a,b,c from #t x
where not exists (
select 1 from #t where a=x.a and id<x.id
)
delcare @a as varchar(20)
delete from #a
declare cur_sor cursor for
select distinct a from aa
open cur_sor
open cur_sor
fetch next from cur_sor into @a
while @@fetch_status = 0
begin
insert into #a
select top 1 * from aa where
a = @a
fetch next from cur_sor into @a
end
这个办法虽然麻烦,但可以实现