|
@@ -1,11 +1,20 @@
|
|
|
CREATE OR REPLACE VIEW view_organization_identification AS
|
|
CREATE OR REPLACE VIEW view_organization_identification AS
|
|
|
- SELECT o.id, o.name, REGEXP_REPLACE(LOWER(o.name), '[^a-z0-9]+', '+') AS normalizedName,
|
|
|
|
|
- o.identifier, o.siretNumber, o.waldecNumber,
|
|
|
|
|
- CONCAT(a.streetAddress, ' ', a.streetAddressSecond, ' ', a.streetAddressThird) AS address,
|
|
|
|
|
- a.addressCity AS city, a.postalCode, c.email, c.telphone
|
|
|
|
|
|
|
+ SELECT o.id, o.name, o.identifier, o.siretNumber, o.waldecNumber,
|
|
|
|
|
+ a.streetAddress, a.streetAddressSecond, a.streetAddressThird, a.addressCity, a.postalCode,
|
|
|
|
|
+ c.email, c.telphone,
|
|
|
|
|
+ REGEXP_REPLACE(
|
|
|
|
|
+ REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(LOWER(trim(o.name)), '[éèê]', 'e'), '[à]', 'a'), '[ç]', 'c'),
|
|
|
|
|
+ '[^a-z0-9]+',
|
|
|
|
|
+ '+'
|
|
|
|
|
+ ) as normalizedName,
|
|
|
|
|
+ REGEXP_REPLACE(
|
|
|
|
|
+ LOWER(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(trim(concat(a.streetAddress, ' ', a.streetAddressSecond, ' ', a.streetAddressThird)), '[éèê]', 'e'), '[à]', 'a'), '[ç]', 'c')),
|
|
|
|
|
+ '[^a-z0-9]+',
|
|
|
|
|
+ '+'
|
|
|
|
|
+ ) as normalizedAddress
|
|
|
FROM opentalent.Organization o
|
|
FROM opentalent.Organization o
|
|
|
- INNER JOIN opentalent.OrganizationAddressPostal oa ON oa.organization_id = o.id
|
|
|
|
|
- INNER JOIN opentalent.AddressPostal a ON a.id = oa.addressPostal_id
|
|
|
|
|
- INNER JOIN opentalent.organization_contactpoint oc ON oc.organization_id = o.id
|
|
|
|
|
- INNER JOIN opentalent.ContactPoint c ON oc.contactPoint_id = c.id
|
|
|
|
|
|
|
+ INNER JOIN opentalent.OrganizationAddressPostal oa ON oa.organization_id = o.id
|
|
|
|
|
+ INNER JOIN opentalent.AddressPostal a ON a.id = oa.addressPostal_id
|
|
|
|
|
+ INNER JOIN opentalent.organization_contactpoint oc ON oc.organization_id = o.id
|
|
|
|
|
+ INNER JOIN opentalent.ContactPoint c ON oc.contactPoint_id = c.id
|
|
|
WHERE oa.type='ADDRESS_HEAD_OFFICE' AND c.contactType='PRINCIPAL';
|
|
WHERE oa.type='ADDRESS_HEAD_OFFICE' AND c.contactType='PRINCIPAL';
|