Jainul Khan
SENIOR EXECUTIVE MANAGER
Pages
Home
About Me
Events & Gallery
Contact
Saturday, September 13, 2014
Find and Delete Duplicate Rows From a Table in SQL Server
WITH
CTE
AS
(
SELECT
*,
RN
=
ROW_NUMBER
()
OVER
(
PARTITION
BY
OrderID
ORDER
BY
OrderID
)
FROM
tbl_Order
)
SELECT
*
FROM
CTE
WHERE
RN
>
1
DELETE
FROM
CTE
WHERE
RN
>
1
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment