Guest User

Untitled

a guest
Jul 24th, 2018
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. Table records like this contents:
  2.  
  3. sh_mail_list:
  4. 1. me@mydomain.com
  5. 2. you@naktibalda.com
  6. 3. others@andtheresite.com
  7.  
  8. table1 (1 record exist):
  9. 1. you@naktibalda.com
  10. 2. somebodyelse@gmail.com
  11.  
  12. tabl2 (1 record exist):
  13. 1. you@naktibalda.com
  14. 2. 124@wrong.com
  15.  
  16. table3 (1 record exist):
  17. 1. me@mydomain.com
  18. 2. others@gmail.com
  19.  
  20. Result should show by searching sh_mailing_list table: 1. others@andtheresite.com
  21.  
  22.  
  23. SQL:
  24. SELECT a . * , b.id, c.id, d.id
  25. FROM sh_mail_list a
  26. LEFT JOIN table1 b ON a.email = b.email
  27. LEFT JOIN table2 c ON a.email = c.email
  28. LEFT JOIN table3 d ON a.email = d.email
  29. WHERE a.group = '5'
  30. AND (
  31. b.id IS NULL
  32. OR c.id IS NULL
  33. OR d.id IS NULL
  34. )
Add Comment
Please, Sign In to add comment