Search
 
SCRIPT & CODE EXAMPLE
 

SQL

Query to remove duplicate rows from a table

DELETE FROM Customers WHERE ROWID(SELECT MAX (rowid) FROM Customers C WHERE CustomerNumber = C.CustomerNumber);
Comment

tsql remove duplicate rows

DELETE T
FROM
(
SELECT *
, DupRank = ROW_NUMBER() OVER (
              PARTITION BY key_value
              ORDER BY (SELECT NULL)
            )
FROM original_table
) AS T
WHERE DupRank > 1
Comment

PREVIOUS NEXT
Code Example
Sql :: sql if function 
Sql :: group_concat mysql 
Sql :: create postgres table 
Sql :: mysql generate create table script 
Sql :: postgres full text search example 
Sql :: how to check default value of column in sql server 
Sql :: mysql trigger 
Sql :: drop database mysql 
Sql :: delete insert record in sql server 
Sql :: UNION ALL LEFT JOIN 
Sql :: mysql workbench format date 
Sql :: sql server inner join convert collation 
Sql :: sql nombre mes mysql 
Sql :: how to check last index rebuild sql server 
Sql :: mssql replace first occurrence 
Sql :: querry mysql by 2 columns 
Sql :: mysql regex phone number 
Sql :: order of execution in sql 
Sql :: mssql now diff 90 day 
Sql :: bigquery information_schema schema all columns 
Sql :: postgres meta command to show all rows in table 
Sql :: check constraint in ms sql 
Sql :: keep getting an error when I try to connect to mysql workbench 
Sql :: SQL Server date literal 
Sql :: sql alter table 
Sql :: Order of execution SQL or MySql query Or Logical order of operations: 
Sql :: mysql sleep connections 
Sql :: show last sql executed in oracle 
Sql :: wp_query raw sql 
Sql :: mysql foreign key 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =