feat: refs #8057 Requested changes

This commit is contained in:
Guillermo Bonet 2024-11-18 10:52:41 +01:00
parent 353ca659cd
commit a64f9b74ec
3 changed files with 8 additions and 6 deletions

View File

@ -10,9 +10,9 @@ CREATE OR REPLACE TEMPORARY TABLE tAddressGeo
FROM address a
JOIN town t ON t.provinceFk = a.provinceFk
JOIN postCode p ON p.townFk = t.id
AND p.`code` = a.postalCode
GROUP BY a.id
ORDER BY (a.city SOUNDS LIKE t.`name`) DESC;
ORDER BY (a.city SOUNDS LIKE t.`name`) DESC,
(p.code = a.postalCode) DESC;
UPDATE address a
JOIN tAddressGeo tag ON tag.id = a.id

View File

@ -13,9 +13,9 @@ CREATE OR REPLACE TEMPORARY TABLE tClientGeo
FROM client c
JOIN town t ON t.provinceFk = c.provinceFk
JOIN postCode p ON p.townFk = t.id
AND p.`code` = c.postcode
GROUP BY c.id
ORDER BY (c.city SOUNDS LIKE t.`name`) DESC;
ORDER BY (c.city SOUNDS LIKE t.`name`) DESC,
(p.code = c.postcode) DESC;
UPDATE client c
JOIN tClientGeo tcg ON tcg.id = c.id

View File

@ -12,9 +12,11 @@ CREATE OR REPLACE TEMPORARY TABLE tSupplierGeo
FROM supplier s
JOIN town t ON t.provinceFk = s.provinceFk
JOIN postCode p ON p.townFk = t.id
AND p.`code` = s.postCode
LEFT JOIN supplierAddress sad ON sad.supplierFk = s.id
GROUP BY s.id
ORDER BY (s.city SOUNDS LIKE t.`name`) DESC;
ORDER BY (s.city SOUNDS LIKE t.`name`) DESC,
(p.code = s.postCode) DESC,
(p.code = sad.postalCode) DESC;
UPDATE supplier s
JOIN tSupplierGeo tsg ON tsg.id = s.id