Good day!

There are 3 tables: price, product and Atable.
product (id, opisanie ...) and tseni(id, tsena_spb , tsena_msk ,...) linked by id.

Atable has 2 columns: price and opisanie.

The task is to replace tseni.tsena_spb and tsena_msk with Atable.price if product.opisanie = Atable.opisanie; .

Request

  select * from (select produkt.opisanie , Atable.price from produkt left join Atable on produkt.opisanie like Atable.desk)t1 where t1.price is not null; 

I got a match.

Faced with complexity - does not update (either the request was not correct, or it did not wait for execution (although it is unlikely)):

 update tseni, Atable2, produkt set tseni.tsena_spb = Atable2.price and tseni.tsena_msk = Atable2.price where produkt.opisanie = Atable2.desk; 

Atable2 is the result of the above sample.

Staying on topic:

 mysql> select * from (select produkt.opisanie , Atable.price from produkt left join Atable on produkt.opisanie like Atable.desk)t1 where t1.price is not null; всего 380 rows mysql> select * from (select produkt.opisanie , Atable.price from produkt left join Atable on SOUNDEX(produkt.opisanie) = SOUNDEX(Atable.desk))t1 where t1.price is not null 836 rows in set (43.22 sec) 

When using the soundex() function in two variables, 836 results were obtained. How rational is it to use if Atable.opisanie in the form:

Tile ceramic wall TREASURE KASHMIR 25x75 cm

Thank you in advance.

    1 answer 1

    In general, I solved the question. Created new Articles_l table

     <code> create table Article_l select * from (select produkt.id, produkt.opisanie , Atable.price from produkt left join Atable on produkt.opisanie like Atable.desk)t1 where t1.price is not null </code> 

    Well, updated ...

     update tseni, Article_l set tseni.tsena_spb = Article_l.price, tseni.tsena_msk=Article_l.price where tseni.id = Article_l.id;