SQLServer中如何获取没有重复的记录,记录中字段有text,或image数据类型

来源:百度知道 编辑:UC知道 时间:2024/06/05 00:47:43
不能以 DISTINCT 方式选择 text、ntext 或 image 数据类型
不用DISTINCT ,还有什么方法?

查询并显示SignsRoadcost不重复的数据

1、表中有IDENTITY 属性字段
假设其IDENTITY 属性字段字段为id
select a.* into # from tb_Allocations a
select * from # a where id in(select min(id) as id from # b
where a. SignsRoadcost=b. SignsRoadcost)

2、表中没有IDENTITY 属性字段
select a.*,id=identity(int,1,1) into # from tb_Allocations a
select * from # a where id in(select min(id) as id from # b
where a. SignsRoadcost=b. SignsRoadcost)

http://zhidao.baidu.com/question/104013793.html

这里是我之前回答别人的。。
要求和你比较类似。。你可以去看看这个