Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select distinct l.*, tmp_addr.address from l.lic as l
- left join l.hou as h on l.lic_id=h.lic_guid
- left join l.org as o on o.org_id=l.org_guid
- LEFT JOIN (
- SELECT address
- FROM dblink('sm_d','SELECT * FROM
- sm.func_get(' || COALESCE(QUOTE_LITERAL(h.hguid), 'NULL') || ', TRUE, ''sm'')')
- AS addr(full_address TEXT, address_guid TEXT)
- ) AS tmp_addr ON h.house_address_guid=tmp_addr.address_guid
- where o.root_organization_ref_guid='b26961ae-f015' and l.status <> 'INACTIVE' and l.version='true' and h.registry_status_type='INCLUDED';
Add Comment
Please, Sign In to add comment