如何选择不同的值? [英] how to select distinct values ?
本文介绍了如何选择不同的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hi
我已选择查询返回重复值
我尝试使用来自表
的selec与众不同的column1,column2,....
但有一个错误
ntext数据类型不能选择为不同.
如何防止在特定列上重复,例如id
hi
i have select query return duplicate value
i try use selec distinct column1,column2,.... from table
but there is an error
the ntext data type cannot be selected as distinct.
how can prevent duplicate on speciefic column such as id
推荐答案
尝试将column1强制转换为varchar
Try casting column1 to a varchar
select distinct cast(column1 as varchar(max)), column2...
尝试一下
Try this
select distinct (col1,col2) from tablename
通过以下链接
^ ]
go through the below link
Here[^]
这篇关于如何选择不同的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文