How to remove the duplicate records based on memberid

Rows are not records. Fields are not columns. One of the many, many ways that rows are not records is that you can have UNIQUE constraints., This is why all SQL forums require DDL and sample data.

Clean up the mess any way you wish, then add constraints. "Mop the floor, then fix the roof"