clear markdown compare help best fiddles feedback dbanow.uk a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 1228811 fiddles created (16675 in the last week).

create table t (name varchar(10), description varchar(100));
 hidden batch(es)


insert into t values ('b', '"Photo number # - Gallery name"');
 hidden batch(es)


insert into t values ('c', '"Photo number # - Gallery name"');
 hidden batch(es)


insert into t values ('a', '"Photo number # - Gallery name"');
 hidden batch(es)


insert into t values ('x', '"Photo number # - Gallery name"');
 hidden batch(es)


update t join (select name, @num := @num + 1 as num from t, (select @num := 0) t order by name) t2 on t2.name = t.name set description = replace(description, '#', cast(num as varchar(10)));
 hidden batch(es)


select * from t order by name;
name description
a "Photo number 1 - Gallery name"
b "Photo number 2 - Gallery name"
c "Photo number 3 - Gallery name"
x "Photo number 4 - Gallery name"
 hidden batch(es)