8144-devToTest_2448 #3216
|
@ -14,9 +14,10 @@ BEGIN
|
|||
SELECT p.geoFk INTO vGeoFk
|
||||
FROM address a
|
||||
JOIN town t ON t.provinceFk = a.provinceFk
|
||||
JOIN postCode p ON p.townFk = t.id AND p.`code` = a.postalCode
|
||||
JOIN postCode p ON p.townFk = t.id
|
||||
WHERE a.id = vSelf
|
||||
ORDER BY (a.city SOUNDS LIKE t.`name`) DESC
|
||||
ORDER BY (a.city SOUNDS LIKE t.name) DESC,
|
||||
(p.code = a.postalCode) DESC
|
||||
LIMIT 1;
|
||||
|
||||
RETURN vGeoFk;
|
||||
|
|
|
@ -15,9 +15,9 @@ BEGIN
|
|||
FROM client c
|
||||
JOIN town t ON t.provinceFk = c.provinceFk
|
||||
JOIN postCode p ON p.townFk = t.id
|
||||
AND p.`code` = c.postcode
|
||||
WHERE c.id = vSelf
|
||||
ORDER BY (c.city SOUNDS LIKE t.`name`) DESC
|
||||
ORDER BY (c.city SOUNDS LIKE t.name) DESC,
|
||||
(p.code = c.postcode) DESC
|
||||
LIMIT 1;
|
||||
|
||||
RETURN vGeoFk;
|
||||
|
|
|
@ -15,9 +15,11 @@ BEGIN
|
|||
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
|
||||
WHERE s.id = vSelf
|
||||
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
|
||||
LIMIT 1;
|
||||
|
||||
RETURN vGeoFk;
|
||||
|
|
Loading…
Reference in New Issue