7806_devToTest_2332 #2801

Merged
alexm merged 126 commits from 7806_devToTest_2330 into test 2024-07-30 06:14:09 +00:00
1 changed files with 15 additions and 2 deletions
Showing only changes of commit 05598b3371 - Show all commits

View File

@ -1,8 +1,21 @@
ALTER TABLE bs.waste ADD buyerFk int(10) unsigned NOT NULL; ALTER TABLE bs.waste ADD buyerFk int(10) unsigned NOT NULL;
CREATE OR REPLACE TEMPORARY TABLE tBuyers
ENGINE = MEMORY
WITH tDistinctBuyers AS (
SELECT DISTINCT buyer
FROM bs.waste w
)
SELECT buyer, u.id
FROM tDistinctBuyers tdb
JOIN account.`user` u ON u.name = tdb.buyer COLLATE utf8mb3_unicode_ci
UPDATE bs.waste w UPDATE bs.waste w
JOIN account.`user` u ON u.name = w.buyer COLLATE utf8mb3_unicode_ci JOIN tBuyers tb ON tb.buyer = w.buyer
SET w.buyerFk = u.id; SET w.buyerFk = tb.id;
DROP TEMPORARY TABLE tBuyers;
ALTER TABLE bs.waste ALTER TABLE bs.waste
DROP PRIMARY KEY, DROP PRIMARY KEY,