This is a discussion on How to remove duplicate records from a table? with out using distinct key? within the Database Support forums, part of the Web Development category; How to remove duplicate records from a table? with out using distinct key?...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Hi, I have used UNION functions to get the distinct result from a table. Here are the details... Quote:
__________________ Keep smiling... |
| |||
| drop table if exists duplicate; CREATE TABLE duplicate ( i int, name varchar(20) ); insert into duplicate values(1,'kumar'); insert into duplicate values(1,'kumar'); insert into duplicate values(2,'ram'); insert into duplicate values(2,'ram'); insert into duplicate values(3,'arjun'); insert into duplicate values(3,'arjun'); SELECT * FROM duplicate; i name ---------------- 1 kumar 1 kumar 2 ram 2 ram 3 arjun 3 arjun to remove the duplicate rows ------------------------------- alter ignore table duplicate add unique index(i,name); SELECT * FROM duplicate; i name ----------------- 1 kumar 2 ram 3 arjun |
| |||
| You can see answer here step by step...
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| Hi, The below should display the distinct values SELECT i,name FROM(select i,name,count(*) from duplicate group by i,name having count(*)>1)t Thanks, Prasath.K |
| |||
| Hi Prasath, You need to modify your query little bit. If i inserted another record into the duplicate table, Quote:
__________________ Keep smiling... |
| |||
| Hi, We concentrate tedious query,but GROUP BY simply do to remove the duplicate records. SELECT i,name from duplicate group by i,name It is working as fine.......... Thanks, Prasath.K |
![]() |
| Thread Tools | |
| Display Modes | |
| |
LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/database-support/3153-how-remove-duplicate-records-table-out-using-distinct-key.html | |||
| Posted By | For | Type | Date |
| DiscussWeb IT Community - Fusing | This thread | Refback | 08-06-2007 10:37 PM |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Delete records from multiple table at a time | Falcon | Database Support | 7 | 04-07-2008 01:12 AM |
| How to get distinct records from datatable | oxygen | C# Programming | 1 | 03-05-2008 02:47 AM |
| Duplicate Content | vadivelanvaidyanathan | Search Engine Optimization | 11 | 02-27-2008 11:10 AM |
| What is the difference between DELETE TABLE and TRUNCATE TABLE commands in SQL Server | oxygen | Database Support | 6 | 11-23-2007 06:17 AM |
| Duplicate elements from an array | vigneshgets | C and C++ Programming | 1 | 09-06-2007 08:04 AM |