Lex Na Wei Ming
Lex Na Wei Ming

Reputation: 75

Possible to have multiple conditions in MYSQL query?

I would like to find out what are the emails that are in my database that are not from @Gmail.com and @Yahoo.com and the email has more than 10 characters. Is this query possible?

I only managed to find out what emails are not from gmail :

SELECT *  FROM `wp_users` WHERE `user_email` NOT LIKE '%@GMAIL.COM'

Thanks in advance!

Upvotes: 0

Views: 48

Answers (1)

juergen d
juergen d

Reputation: 204746

Use and to combine multiple conditions

SELECT * FROM wp_users 
WHERE user_email NOT LIKE '%@GMAIL.COM'
  AND user_email NOT LIKE '%@YAHOO.COM'
  AND CHAR_LENGTH(user_email) > 10

Upvotes: 2

Related Questions