ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

What is the easiest way to remove duplicate rows in a table ?

user-image
تم إضافة السؤال من قبل Amine Abdallah Doukara , 1 , Sonatarch
تاريخ النشر: 2016/02/24
Amine Abdallah Doukara
من قبل Amine Abdallah Doukara , 1 , Sonatarch

easiest way  using close group by and having:

 

exemple: table T1 with  colomn A

DELETE     T1 WHERE     A    IN (                SELECT    A                FROM       T1                GROUP BY  A                HAVING       COUNT (*)     > 1              ) ;

GALIB MIRZA GALIB MIRZA
من قبل GALIB MIRZA GALIB MIRZA , Desktop support engineer , wipro infotech

use distinct keyword in your query to remove duplication of data. its actually remove duplicated entry in your result set but its does not permanently removed from data base. for example if we write a query like this way

 

select distinct city  from student;

it will fetched all the cities name associated with table student but do not show same city name(e.g kolkata) even it is entered in  different row. that means if kolkata city is used for multiple student its does not show kolkata for multiple time as distinct is used  

Dineshkumar Murugesan
من قبل Dineshkumar Murugesan , SoftwareEngineer , EasyDesignSystems.Pvt Ltd

Distinct  option is the easiest way to remove Duplicate rows

المزيد من الأسئلة المماثلة

هل تحتاج لمساعدة في كتابة سيرة ذاتية تحتوي على الكلمات الدلالية التي يبحث عنها أصحاب العمل؟