Prepare for your Next Interview
This is a discussion on Delete duplicate records without using "rowid" within the SQL forums, part of the Databases category; Question asked by visitor Joe Hi all! Good Evening. I would like to know if it is possible to delete duplicate records from a table with out using "rowid" using ...
|
|||
|
Delete duplicate records without using "rowid"
Question asked by visitor Joe
Hi all! Good Evening. I would like to know if it is possible to delete duplicate records from a table with out using "rowid" using MYSQL only. Can use "rownum". Plz help me in this regard. Thanx in advance. Bye |
| Sponsored Links |
|
|||
|
Re: Delete duplicate records without using "rowid"
One example is here
create table t1(col1 int, col2 int, col3 char(50)) insert into t1 values (1, 1, 'data value one') insert into t1 values (1, 1, 'data value one') insert into t1 values (1, 2, 'data value SELECT col1, col2, count(*) FROM t1 GROUP BY col1, col2 HAVING count(*) > 1 delete from t1 where col1=1 and col2=1 |
|
|||
|
Re: Delete duplicate records without using "rowid"
Yes, it deletes both 1st and 2nd records.
I think there is no solution without using ROWID.
__________________
Lack of WILL POWER has caused more failure than lack of INTELLIGENCE or ABILITY. -sutnarcha- |
|
|||
|
Re: Delete duplicate records without using "rowid"
Try this....
delete from table where rowid=(select max(rowid) from table group by dup_field_name having count(*) > 2) Thanks... |
|
|||
|
Re: Delete duplicate records without using "rowid"
Quote:
Thanks |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Filling "Date Creation" field with the current day | Lokesh M | Test Director | 1 | 02-27-2008 08:39 AM |
| Table that houses "field selection" | Cayenne | SAP R/3 | 0 | 04-12-2007 02:02 PM |
| What is ""developing procedures and scripts (UNIX/Windows/Oracle) | spd15 | Testing Issues | 1 | 04-04-2007 09:01 AM |
| Business Objects - parsed failed "ORA-00936: missing expression :-936" | JobHelper | Data Warehousing | 0 | 02-11-2007 06:06 AM |
| McAfee launches "TOTAL PROTECTION" Beta | Lokesh M | Geeks Lounge | 0 | 06-22-2006 08:44 AM |