具有多个like运算符的SQL查询

时间:2016-10-28 17:58:44

标签: mysql

我需要提取国家名称为日本的记录,电子邮件以这些值结束。

select * from vw_dwcontact 
where countryname = 'japan'
and email_address like '%.kr' or 
email_address like '%.kp' or
email_address like '%.it' or
email_address like '%.co' or
email_address like '%.pe' or
email_address like '%.ve' or
email_address like '%.ec' or
email_address like '%.gt' or
email_address like '%.bo' or
email_address like '%.do' or
email_address like '%.hn' or
email_address like '%.py' or
email_address like '%.sv' or
email_address like '%.br' or
email_address like '%.mx' or
email_address like '%.ar' or
email_address like '%.cl' or
email_address like '%.cn' or
email_address like '%.de' or
email_address like '%.ru' or
email_address like '%.fr' or
email_address like '%.es' 

当我运行上述查询并且结果集返回不包含日本的记录时?这个查询有什么问题?如果where子句指定countryname ='japan',则它应仅返回具有上述指定电子邮件地址的国家/地区的记录。

请帮忙! 感谢。

0 个答案:

没有答案