I need to update column value based on other column with adding separator and with manage duplicates values using sql query.
For example :
I have one database table A.
Here in it two columns :
1) locality
2) slug
Locality column already have data.
So need to update 'slug' column based on locality value.
Please review below screenshots.
Currently i have below table.
Best Answer
Assuming the
suburb_id
is autoincremental primary key:If not, then simply convert CTE to subquery: