Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

how to delete duplicate rows from a specified table(only
single table)
how do you know which join is need to be used

Answer Posted / jas

delete from table_name where rowid > (select min(rowid)
from table_name where a.col_name=b.col_name)

create new_table as select distinct * from table_name;
drop table_name;
create table_name as select * from new_table;
drop new_table;

delete from table_name where rowid not in (select max
(rowid) from table_name where a.col_name=b.col_name)

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is clustered index a primary key?

879


Can we commit in trigger?

919


What is the maximum size of sqlite database?

1039


Why trigger is used in sql?

912


What are %type and %rowtype for?

1009


How do you change a value in sql?

959


What are tuples in sql?

1056


Which is better join or inner query?

955


what is an alias command? : Sql dba

1006


What are the different tcl commands in sql?

1102


How many times can we commit in a loop?

954


What are the different types of tables in sql?

925


What is triggering circuit?

1011


How do I view stored procedures?

912


How many developers work on postgresql?

909