Skip to content
Advertisement

Indexing distinct values for a column

I have a table containing a column authors that contains names of authors for different articles (different rows). I want to add a new column that contains a unique index for every author,i.e. let’s say 12 for every occurrence of Dickens (just a random pick) in the author column.

Can it be done by a MySQL query or will I have to write a new script for doing this?

Advertisement

Answer

See SQL Fiddle

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