sql去掉ntext类型的重复记录
时间:2011-02-18 来源:孤独者
create table Product
(
id int identity(1,1) primary key,
productName nvarchar(100),
price decimal,
description ntext
)
1.将ntext类型强制转换为nvarchar
select distinct id,productName,price,cast(description as nvarchar(4000)) as description
from Product
2.使用子查询过滤
select id,productName,price,description
from Product
where id in
(
select max(id) from Product
group by productName,price,description//除了主键不同,其他字段内容全部相同,对其他字段进行分组
)
相关阅读 更多 +