Compare commits
2 Commits
e81727f3f8
...
754c0cb9ab
Author | SHA1 | Date |
---|---|---|
Guillermo Bonet | 754c0cb9ab | |
Guillermo Bonet | a64f9b74ec |
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue