Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Table records like this contents:
- sh_mail_list:
- 1. me@mydomain.com
- 2. you@naktibalda.com
- 3. others@andtheresite.com
- table1 (1 record exist):
- 1. you@naktibalda.com
- 2. somebodyelse@gmail.com
- tabl2 (1 record exist):
- 1. you@naktibalda.com
- 2. 124@wrong.com
- table3 (1 record exist):
- 1. me@mydomain.com
- 2. others@gmail.com
- Result should show by searching sh_mailing_list table: 1. others@andtheresite.com
- SQL:
- SELECT a . * , b.id, c.id, d.id
- FROM sh_mail_list a
- LEFT JOIN table1 b ON a.email = b.email
- LEFT JOIN table2 c ON a.email = c.email
- LEFT JOIN table3 d ON a.email = d.email
- WHERE a.group = '5'
- AND (
- b.id IS NULL
- OR c.id IS NULL
- OR d.id IS NULL
- )
Add Comment
Please, Sign In to add comment