本文共 1339 字,大约阅读时间需要 4 分钟。
以前写的东西,可以看看思路
/**/ /*删除表中重复行的方法*/ if exists ( select 1 from sys.tables where name = ' t_dup ' ) drop table t_dup go create table t_dup(id int ,age int ,name varchar ( 32 )) insert into t_dup select 1 , 1 , ' a ' union all select 1 , 1 , ' a ' union all select 1 , 1 , ' a ' union all select 1 , 2 , ' a ' union all select 1 , 2 , ' e ' union all select 2 , 3 , ' b ' union all select 3 , 3 , ' d ' go select * from t_dup go with t_all as ( select id,age,name,row_number() over ( order by id) [ num ] from t_dup), t_max as ( select id,age,name, max (num) num from t_all group by id,age,name) select id,name,age from t_all a where exists ( select 1 from t_max where num = a.num) <script type="text/javascript">document.write("
");</script>
<script type="text/javascript">LoadFeedbackCount();</script> <script language="javascript" type="text/javascript"> ad_width=468; ad_height=60; adcss=2; unionuser=19; tags=''; ad_type='j'; count=2; </script> <script type="text/javascript" src="http://tagegg.csdn.net/showads.js" language="javascript"></script> <script src="http://tagegg.csdn.net/b.aspx?action=displayad&unionuser=19&unionurl=http%3A%2F%2Fblog.csdn.net%2Fwhbo%2Farchive%2F2008%2F05%2F07%2F2412445.aspx&adcss=2&ad_type=j&width=468&height=60&ad_color=&ad_color_border=&count=2" language="JavaScript1.1" type="text/javascript"></script>