i want to keep yellow underlined entry and delete the remaining entries. i mean keep first created entry only ,
Delete duplicate entry
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
i want to keep yellow underlined entry and delete the remaining entries. i mean keep first created entry only ,
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Amit MohantyRank #112 · 20K reputationPosted Nov 25, 2022, 12:09 AM EST
Try this
;WITH CTE([adv_referenceno], [adv_createdon], [duplicate]) AS (SELECT [adv_referenceno], [adv_createdon], ROW_NUMBER() OVER(PARTITION BY [adv_referenceno] ORDER BY [adv_createdon]) AS [duplicate] FROM [dbo].[NSP113_Advances]) DELETE FROM CTE WHERE [duplicate] > 1;For more details check the link
https://www.c-sharpcorner.com/article/different-ways-to-find-and-delete-duplicate-rows-from-a-table-in-sql-server/
Aravind GovindarajRank #430 · 5.8K reputationPosted Nov 24, 2022, 10:39 AM EST
You can do with the help of CTE option. please find the link for reference
https://www.c-sharpcorner.com/blogs/delete-duplicate-record-from-sql-data-table-using-cte
Jignesh KumarRank #91 · 22.9K reputationPosted Nov 24, 2022, 11:13 PM EST
Hello Lejo,
Please refer this one which will help you out to delete duplicate records,
https://www.c-sharpcorner.com/blogs/delete-duplicate-rows-in-sql
https://www.c-sharpcorner.com/article/different-ways-to-find-and-delete-duplicate-rows-from-a-table-in-sql-server/