问题描述
- SQLServer表去掉重复字段数据?
-
我有一张表,SQLServer表名EvaluateTeacherGrade,如下图所示:
问题:我如何获得如下表:teacherID 20070101 22222001 也就是去掉重复的??
恳请各位行家高手不吝惜指教!万分感谢!!
解决方案
select distinct teacherID from EvaluateTeacherGrade
解决方案二:
select distinct teacherID from EvaluateTeacherGrade
解决方案三:
select distinct teacherID from EvaluateTeacherGrade
或
select teacherID from EvaluateTeacherGrade group by teacherID
解决方案四:
筛选出不同的teacherID ,然后存入一个新的表newTable中。
select distinct teacherID into #Tmp from EvaluateTeacherGrade;
select * into newTable from #Tmp;
drop table #Tmp;
解决方案五:
加入distinct字符,表示查询结果不重复
解决方案六:
select distinct teacherID from EvaluateTeacherGrade
时间: 2024-12-01 20:46:21