Guest User

Untitled

a guest
Apr 22nd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 1.05 KB | None | 0 0
  1. SELECT 1
  2. FROM transaction_contacts_view tcv
  3. LEFT JOIN contacts c ON c.id = tcv.contact_id
  4. --LEFT JOIN addresses a ON a.id = tcv.address_id
  5. WHERE
  6.      (
  7.         c.name ILIKE '%'||'sprint'||'%'
  8.         OR c.first_name ILIKE '%'||'sprint'||'%'
  9.         OR c.last_name ILIKE '%'||'sprint'||'%'
  10.         OR c.company ILIKE '%'||'sprint'||'%'
  11.         --OR a.address1 || ' ' || a.address2 ILIKE '%'||'sprint'||'%'
  12.         --OR a.city || ', ' || a.code ILIKE '%'||'sprint'||'%'
  13.         --OR a.county ILIKE '%'||'sprint'||'%'
  14. )
  15.  
  16. UNION
  17.  
  18. SELECT 1
  19. FROM transaction_contacts_view tcv
  20. --LEFT JOIN contacts c ON c.id = tcv.contact_id
  21. LEFT JOIN addresses a ON a.id = tcv.address_id
  22. WHERE
  23.      (
  24.         --c.name ILIKE '%'||'sprint'||'%'
  25.         --OR c.first_name ILIKE '%'||'sprint'||'%'
  26.         --OR c.last_name ILIKE '%'||'sprint'||'%'
  27.         --OR c.company ILIKE '%'||'sprint'||'%'
  28.         a.address1 || ' ' || a.address2 ILIKE '%'||'sprint'||'%'
  29.         OR a.city || ', ' || a.code ILIKE '%'||'sprint'||'%'
  30.         OR a.county ILIKE '%'||'sprint'||'%'
  31. )
Add Comment
Please, Sign In to add comment