Suppose we have a table tblStock with field StcokID which has following values:
GOOG
BA
GOOG
YAHOO
GOOG
Following query can be used to remove duplicate rows in this case:
DELETE TOP (SELECT COUNT(*) -1 FROM tblStock WHERE StockID = 'GOOG')
FROM tblStock WHERE StockID = 'GOOG'
GOOG
BA
GOOG
YAHOO
GOOG
Following query can be used to remove duplicate rows in this case:
DELETE TOP (SELECT COUNT(*) -1 FROM tblStock WHERE StockID = 'GOOG')
FROM tblStock WHERE StockID = 'GOOG'
No comments:
Post a Comment