文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
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//除了主键不同,其他字段内容全部相同,对其他字段进行分组

)

相关阅读 更多 +
排行榜 更多 +
金币大富翁无限资源版

金币大富翁无限资源版

模拟经营 下载
度假酒店故事全部解锁

度假酒店故事全部解锁

模拟经营 下载
打工买房模拟器免广告

打工买房模拟器免广告

模拟经营 下载