7806_devToTest_2332 #2801
|
@ -1,5 +1,5 @@
|
|||
ALTER TABLE bs.waste ADD buyerFk int(10) unsigned NOT NULL;
|
||||
|
||||
USE vn;
|
||||
CREATE OR REPLACE TEMPORARY TABLE tBuyers
|
||||
ENGINE = MEMORY
|
||||
WITH tDistinctBuyers AS (
|
||||
|
@ -8,8 +8,7 @@ CREATE OR REPLACE TEMPORARY TABLE tBuyers
|
|||
)
|
||||
SELECT buyer, u.id
|
||||
FROM tDistinctBuyers tdb
|
||||
JOIN account.`user` u ON u.name = tdb.buyer COLLATE utf8mb3_unicode_ci
|
||||
|
||||
JOIN account.`user` u ON u.name = tdb.buyer COLLATE utf8mb3_unicode_ci;
|
||||
|
||||
UPDATE bs.waste w
|
||||
JOIN tBuyers tb ON tb.buyer = w.buyer
|
||||
|
@ -51,4 +50,4 @@ INSERT INTO bs.waste
|
|||
|
||||
ALTER TABLE bs.waste ADD CONSTRAINT waste_pk PRIMARY KEY (`year`, `week`, buyerFk, itemTypeFk, itemFk);
|
||||
|
||||
DROP TEMPORARY TABLE tBuyers, tWasteUnique;
|
||||
DROP TEMPORARY TABLE tWasteUnique;
|
||||
|
|
Loading…
Reference in New Issue