日期:2014-05-17  浏览次数:20816 次

SQL语句过滤掉完成重复的行
如图,执行 
select  * 
from PeisPatientExamItem
where  ID_PatientFeeItem = '228428'
结果存在完全一样的数据,
想通过sql语句过滤掉

使用 distinct  提示我
text 数据类型不能选为 DISTINCT,因为它不可比。


------解决方案--------------------
把那一列text类型转化一下:

cast(xx as varchar(max))
------解决方案--------------------
select DISTINCT cast(text字段 as varchar(max))
from PeisPatientExamItem
where  ID_PatientFeeItem = '228428'