I have created a pretty messy table that I need to clean up. This is not an easy task.
Situation:
- Messy table is called tbl_users.
- It contains information about a user. It has a unique ID.
- The most unique colomn is phone_number which identifies a user.
For varoius reasons I have the same user with the same phone number more than once in this table.
You can see when it is created in a colomn called created_date.
What i need:
- I need to find the FIRST created instance of each user and then I
need to find - all the ID’s of the second and even maybe third instance of the user,
if
such exists.
I need the ID’s because there’s data from other tables where I need to change the user_id to first instance.
How do I proceed with this challenge?
1 Answer