Guest User

Untitled

a guest
Nov 12th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. select distinct l.*, tmp_addr.address from l.lic as l
  2. left join l.hou as h on l.lic_id=h.lic_guid
  3. left join l.org as o on o.org_id=l.org_guid
  4. LEFT JOIN (
  5. SELECT address
  6. FROM dblink('sm_d','SELECT * FROM
  7. sm.func_get(' || COALESCE(QUOTE_LITERAL(h.hguid), 'NULL') || ', TRUE, ''sm'')')
  8. AS addr(full_address TEXT, address_guid TEXT)
  9. ) AS tmp_addr ON h.house_address_guid=tmp_addr.address_guid
  10. 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