I have a sql statement where I want to join update with select but it gives me the following error:
Error Code: 1093. Table 'a' is specified twice, both as a target for 'UPDATE' and as a separate source for data 0.000 sec
My sentence is as follows:
update inv_articulo set ref = (select concat(c.prefijo_cat, '-', lpad(a.pk_articulo, 4, '0')) from inv_categoria as c
inner join inv_tipoarticulo as t on c.pk_categoria = t.fk_categoria
inner join inv_articulo as a on t.pk_tipo = a.tipo_articulo
where a.tipo_articulo = 26 and a.pk_articulo = 16)
Any help?