如何删除重复? [英] how to remove duplicate?

查看:59
本文介绍了如何删除重复?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我是sql sever 2008的新手r2.Actuvally我使用CTE删除重复数据。所以,

i写下这样的查询





Hi i am new to sql sever 2008 r2.Actuvally i am use CTE to remove the Duplicate data. so,
i wrote query like this given below


 ;WITH CTE(NAME_TYPE,SCORE,PERCENTAGE,SCORE1,PERCENTAGE1,SCORE2,PERCENTAGE2,NAME_TYPE )
  AS
  (
  SELECT NAME_TYPE,SCORE,PERCENTAGE,SCORE1,PERCENTAGE,SCORE2,PERCENTAGE,ROW_NUMBER()over(PARTITION BY  NAME_TYPE ORDER BY NAME_TYPE )  FROM INDIVIDUAL
  )
SELECT * FROM CTE





o / p:



o/p:

NAME_TYPE   SCORE PERCENTAGE SCORE1 PERCENTAGE1 SCORE2 PERCENTAGE2
RAM           45    5%             
RAHUL         47    3%
RAHUL                         30          5%                  
RAHUL                                             45      7%
RAGU                          60         10% 
RAGU                                              70       2%







i必须删除name_type列中的副本帮助我..



i我有这样的表






i have to remove the duplicate in name_type column help me..

i am having table like this

id   nametype  score           date
1      Ram      1             07-06-2013
1      Rahul     2            07-06-2013
1      Rahul     3             05-05-2012
1       Rahul    4              06-5-2011
1       Ragu      6            07-4-2012
1        Ragu      7            07-04-2011





o / p;



o/p;

Name-type     2013-2012     2012-2011   2011-2010
  Ram           12 3%
  Rahul         11 10%       4 5%
  Ragu                                      13 6%





我已经完成了一半的日期工作,我已经确定总分和百分比。但我正在考虑这样的事情



half of i completed i done daterange i calicated total score and percentage .but i am geting o/p like this

name_type      2013-2012      2012-2011  2011-2010
Ram              12 3$
Rahul            11 10%
Rahul                            4 5%
Ragu                                        13 6%





i想要删除name_type coloumn.how中的dupilcta?请帮帮我



i want to remove dupilctaes in name_type coloumn.how ? please help me

推荐答案

Rahul 11​​ 10%
Rahul 4 5%
Ragu 13 6%
Rahul 11 10% Rahul 4 5% Ragu 13 6%




i想要删除name_type coloumn.how中的dupilcta?请帮助我



i want to remove dupilctaes in name_type coloumn.how ? please help me


使用distinct关键字删除重复。
use distinct keyword to remove duplicate.


创建临时表,然后填充唯一的NAME_TYPE列。然后填充其余列。
Create a temp table then populate the unique "NAME_TYPE" column. Then populate the remaining columns.


这篇关于如何删除重复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆