文章详情

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

)

相关阅读 更多 +
排行榜 更多 +
XLM币最具爆发力的安全交易所币安binance下载

XLM币最具爆发力的安全交易所币安binance下载

金融理财 下载
XEM币最安全隐私链的全球交易所币安binance下载

XEM币最安全隐私链的全球交易所币安binance下载

金融理财 下载
WAVES币最新上线的优质交易所币安binance下载

WAVES币最新上线的优质交易所币安binance下载

金融理财 下载