There are 2 tables identical in fields in one DB. Sirovyna and zayavki. Please tell me what kind of query can take kol values from one table from kol values in another table. The id and naim fields will be the same. Table sirovyna
1 answer
This is if you need to get the difference:
SELECT (s.kol - z.kol) FROM sirovyna s JOIN zayavki z ON s.id = z.id AND s.naim = z.naim; This is if you need to change the first table:
UPDATE sirovyna AS s JOIN zayavki AS z ON s.id = z.id AND s.naim = z.naim SET s.kol = (s.kol - z.kol); - Thanks a lot! :) - Vladislav
|
