8144-devToTest_2448 #3216
|
@ -7,14 +7,14 @@ CREATE OR REPLACE TEMPORARY TABLE tmp.tAddressGeo
|
|||
(PRIMARY KEY (id))
|
||||
ENGINE = MEMORY
|
||||
SELECT a.id, p.geoFk
|
||||
FROM address a
|
||||
JOIN town t ON t.provinceFk = a.provinceFk
|
||||
JOIN postCode p ON p.townFk = t.id
|
||||
FROM vn.address a
|
||||
JOIN vn.town t ON t.provinceFk = a.provinceFk
|
||||
JOIN vn.postCode p ON p.townFk = t.id
|
||||
GROUP BY a.id
|
||||
ORDER BY (a.city SOUNDS LIKE t.`name`) DESC,
|
||||
(p.code = a.postalCode) DESC;
|
||||
|
||||
UPDATE address a
|
||||
UPDATE vn.address a
|
||||
JOIN tmp.tAddressGeo tag ON tag.id = a.id
|
||||
SET a.geoFk = tag.geoFk;
|
||||
|
||||
|
|
|
@ -10,14 +10,14 @@ CREATE OR REPLACE TEMPORARY TABLE tmp.tClientGeo
|
|||
(PRIMARY KEY (id))
|
||||
ENGINE = MEMORY
|
||||
SELECT c.id, p.geoFk
|
||||
FROM client c
|
||||
JOIN town t ON t.provinceFk = c.provinceFk
|
||||
JOIN postCode p ON p.townFk = t.id
|
||||
FROM vn.client c
|
||||
JOIN vn.town t ON t.provinceFk = c.provinceFk
|
||||
JOIN vn.postCode p ON p.townFk = t.id
|
||||
GROUP BY c.id
|
||||
ORDER BY (c.city SOUNDS LIKE t.`name`) DESC,
|
||||
(p.code = c.postcode) DESC;
|
||||
|
||||
UPDATE client c
|
||||
UPDATE vn.client c
|
||||
JOIN tmp.tClientGeo tcg ON tcg.id = c.id
|
||||
SET c.geoFk = tcg.geoFk;
|
||||
|
||||
|
|
|
@ -9,16 +9,16 @@ CREATE OR REPLACE TEMPORARY TABLE tmp.tSupplierGeo
|
|||
(PRIMARY KEY (id))
|
||||
ENGINE = MEMORY
|
||||
SELECT s.id, p.geoFk
|
||||
FROM supplier s
|
||||
JOIN town t ON t.provinceFk = s.provinceFk
|
||||
JOIN postCode p ON p.townFk = t.id
|
||||
LEFT JOIN supplierAddress sad ON sad.supplierFk = s.id
|
||||
FROM vn.supplier s
|
||||
JOIN vn.town t ON t.provinceFk = s.provinceFk
|
||||
JOIN vn.postCode p ON p.townFk = t.id
|
||||
LEFT JOIN vn.supplierAddress sad ON sad.supplierFk = s.id
|
||||
GROUP BY s.id
|
||||
ORDER BY (s.city SOUNDS LIKE t.`name`) DESC,
|
||||
(p.code = s.postCode) DESC,
|
||||
(p.code = sad.postalCode) DESC;
|
||||
|
||||
UPDATE supplier s
|
||||
UPDATE vn.supplier s
|
||||
JOIN tmp.tSupplierGeo tsg ON tsg.id = s.id
|
||||
SET s.geoFk = tsg.geoFk;
|
||||
|
||||
|
|
Loading…
Reference in New Issue