write a query to remove duplicate records without using primary key column?




Answers were Sorted based on User's Feedback



write a query to remove duplicate records without using primary key column?..

Answer / 312

351

Is This Answer Correct ?    3 Yes 3 No

write a query to remove duplicate records without using primary key column?..

Answer / mathanrathinam


delete tmp from(select col1,col2,row_number over(partition by col1,col2 order by col1,col2) rownum from tablename) tmp
where rownum >1

Is This Answer Correct ?    7 Yes 8 No

Post New Answer




More SQL Server Interview Questions

sql server syntax to add "!" sign to "name" field of "employee" table in a manner that all names have the same lenght of 20 characters

1 Answers  


There is a trigger defined for INSERT operations on a table, in an OLTP system. The trigger is written to instantiate a COM object and pass the newly insterted rows to it for some custom processing. What do you think of this implementation? Can this be implemented better?

1 Answers   HCL,


statement (of account) Receive ID_receive Date_receive Amount_receive TO_receive From_receive Description_receive 1 2010/01/01 500 Bank Ahmed Payment from the account 2 2010/02/01 700 Bank Ahmed Payment from the account Payment ID_payment Date_payment Amount_payment From_payment To_payment Description_payment 1 2010/03/01 1000 Ahmed Sales Sale goods 2 2010/04/01 1500 Ahmed Sales Sale goods How can crate Stored Procedures for the statement (of account) from these tables? I want statement (of account) like this: (in sql 2005) ID_ name description debit account credit account balance

1 Answers  


How to check what was the last restore transaction LSN in Log shipping or Mirroring? when we don't have a Monitor or witness server.

0 Answers   IBM,


About types of indexes in SQL server ?

2 Answers   Cognizant,






i want table name basis on column name.

5 Answers  


How can I create a plain-text flat file from SQL Server as input to another application?

2 Answers  


What are three SQL keywords used to change or set someone?s permissions?

3 Answers  


syntax for deleting the database in T SQL

5 Answers  


How much memory that we are using in Logshipping Concept?

0 Answers  


How efficient you are in oracle and SQL server?

0 Answers   CGI,


Define Foreign Key?

3 Answers   ADP, College School Exams Tests,






Categories