Skip to content
Advertisement

How to move ID of duplicate names to a separate column

I have a MySQL table with two duplicate names, how can I separate the IDs of the duplicate names into a separate column?

For example, like this:

This is my current SQL statement to retrieve the current results in the first table:

There is only one duplicate at most for each name.

Thanks

Advertisement

Answer

If you are sure that the maximum is always 2… then you could:

If you want to sofisticate a little bit more the query

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement