B
B
baimkin2018-11-18 19:03:27
SQLite
baimkin, 2018-11-18 19:03:27

How to update the table according to the conditions from the second table?

There are 2 tables.
Products has an empty manager field and filled catalog and brand fields.
tempSM contains the filled manager, catalog and brand data.
You need to update the manager field in the products table with data from tempSM by matching the catalog and brand pair.
I threw in such a request, but it runs for some unrealistically long time and sets the same value to all rows.

UPDATE products SET manager = (SELECT tempSM.manager FROM [tempSM] WHERE tempSM.catalog = products.catalog AND tempSM.brand = products.brand)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question