首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

如何删除表中某个字段的值一样,但其他字段值不一样的记录

2012-08-15 
怎么删除表中某个字段的值一样,但其他字段值不一样的记录例如表 tbshow中idnoentdt2050730012009-07-07205

怎么删除表中某个字段的值一样,但其他字段值不一样的记录
例如表 tbshow中


idno entdt
205073001 2009-07-07
205073001 2006-05-08
205073001 2003-08-14

想删除剩下最近一条记录 
5073001 2009-07-07
得怎么写语句 ?

[解决办法]

SQL code
delete t from tbshow t where exists(select 1 from tbshow where idno=t.idno and dntdt>t.entdt) 

热点排行