8144-devToTest_2448 #3216
|
@ -10,9 +10,9 @@ CREATE OR REPLACE TEMPORARY TABLE tAddressGeo
|
||||||
FROM address a
|
FROM address a
|
||||||
JOIN town t ON t.provinceFk = a.provinceFk
|
JOIN town t ON t.provinceFk = a.provinceFk
|
||||||
JOIN postCode p ON p.townFk = t.id
|
JOIN postCode p ON p.townFk = t.id
|
||||||
AND p.`code` = a.postalCode
|
|
||||||
GROUP BY a.id
|
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
|
UPDATE address a
|
||||||
JOIN tAddressGeo tag ON tag.id = a.id
|
JOIN tAddressGeo tag ON tag.id = a.id
|
||||||
|
|
|
@ -13,9 +13,9 @@ CREATE OR REPLACE TEMPORARY TABLE tClientGeo
|
||||||
FROM client c
|
FROM client c
|
||||||
JOIN town t ON t.provinceFk = c.provinceFk
|
JOIN town t ON t.provinceFk = c.provinceFk
|
||||||
JOIN postCode p ON p.townFk = t.id
|
JOIN postCode p ON p.townFk = t.id
|
||||||
AND p.`code` = c.postcode
|
|
||||||
GROUP BY c.id
|
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
|
UPDATE client c
|
||||||
JOIN tClientGeo tcg ON tcg.id = c.id
|
JOIN tClientGeo tcg ON tcg.id = c.id
|
||||||
|
|
|
@ -12,9 +12,11 @@ CREATE OR REPLACE TEMPORARY TABLE tSupplierGeo
|
||||||
FROM supplier s
|
FROM supplier s
|
||||||
JOIN town t ON t.provinceFk = s.provinceFk
|
JOIN town t ON t.provinceFk = s.provinceFk
|
||||||
JOIN postCode p ON p.townFk = t.id
|
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
|
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
|
UPDATE supplier s
|
||||||
JOIN tSupplierGeo tsg ON tsg.id = s.id
|
JOIN tSupplierGeo tsg ON tsg.id = s.id
|
||||||
|
|
Loading…
Reference in New Issue