Write a query to delete duplicate records in SQL SERVER
Answer Posted / anuj dhingra
DELETE
FROM MyTable
WHERE ID NOT IN
(
SELECT MAX(ID)
FROM MyTable
GROUP BY DuplicateColumn1, DuplicateColumn2,
DuplicateColumn2)
| Is This Answer Correct ? | 12 Yes | 8 No |
Post New Answer View All Answers
Explain what is row_number function?
What is the log shipping?
what is database replication? : Sql server database administration
Explain contrast amongst grouped and non-bunched records?
What is lock escalation? : sql server database administration
Can you import Microsoft Excel data to SSRS?
How to enter date and time literals in ms sql server?
How do you set a trace flag in sql server?
please differentiate between delete and truncate?
What is the use of =,==,=== operators?
This question asked during interview, 2) At the end of each month, a new table is created for each bank that contains monthly metrics consolidated at the account level. The table naming convention is bankX_YYYYMM where X represents the numeric designation of the bank and YYYYMM indicates the 4 digit year and 2 digit month. The tables contain the following fields: name data type description account text account number registered boolean indicates whether the account is registered num_trans integer number of transactions made during the time period spend numeric(9,2) total spend during the time period a) Write a SQL query that will display the total number of transactions and total spend for "Bank1" during the 4th quarter of 2009. b) Write a SQL query that will display the total number of transactions and total spend at "Bank1" and "Bank2", broken out by registered vs. non-registered accounts, during January 2010 not sure what is correct answer and how to solve?
How to create a scrollable cursor with the scroll option?
What structure can you implement for the database to speed up table reads?
What are acid properties of transaction?
Can I save my report as html, excel or word? : sql server management studio