快活林资源网 Design By www.csstdc.com
复制代码 代码如下:
--建立数据表createtable TestData
(
ID int identity(1,1) primary key,
Data int,
ColA varchar(20),
ColB varchar(20)
)
go

--插入测试数据
declare @counts int
declare @i int
set @counts = 10000
set @i = 1

while @i<=@counts
begin
insert TestData (Data,ColA,ColB) values(cast(rand()*10000 as int),cast(rand() as varchar(20)),cast(rand() as varchar(20)))
set @i=@i+1
end

--获取数据(重复数据只取一条)
select * from TestData
where
id in
(
--根据Data分类获取数据最小ID列表
select min(id) from TestData
group by Data
)
快活林资源网 Design By www.csstdc.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
快活林资源网 Design By www.csstdc.com