日期:2014-05-18  浏览次数:20549 次

如何去掉重复的记录?
有一个表std
列:stdid,stdname,stdclass,stdgrade
表中有stdname相同但是std不同的记录。
现在要把取stdid和stdname两列,
要求:stdname的值是唯一值。
请问该怎么做?

------解决方案--------------------
select min(stdid),stdname from std group by stdname
------解决方案--------------------
参考:
Select * From std Where stdid not in
(Select Min(stdid) From std as P Where P.stdname = stdid.stdname)

------解决方案--------------------

select stdid,stdname
from 表
where not exists(select 1 from 表 where stdname=a.stdname and stdid> a.stdid)
--这里 ' < '或者 '> '均可
------解决方案--------------------
楼上不对
------解决方案--------------------
方法有很多种的,不过
dongdongxxx(独自爱你) 的方法不行的。
一楼他们的都可以
-----------
如果你有MSN想挂金币,金币可以换钱或换奖品可以到这边注册
http://www.5sai.com/r.do?r=123086
------解决方案--------------------
这样做不是就丢失纪录了吗