文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>sql去掉ntext类型的重复记录

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//除了主键不同,其他字段内容全部相同,对其他字段进行分组

)

相关阅读 更多 +
排行榜 更多 +
中国铁路模拟器

中国铁路模拟器

模拟经营 下载
好看证件照

好看证件照

图像拍照 下载
凯洋购物

凯洋购物

购物比价 下载