1. 只能使用嵌套查询了
select * from (select * from view_label_tab_campaign where ADOFFER_ID='7') as sea where sea.CAMPAIGN_ID like '%2%' or sea.CAMPAIGN_NAME like '%2%' ;
+---------------------+--------------+-------------+---------------+--------+------------+------------+
| CampListLabel | CampLabel | CAMPAIGN_ID | CAMPAIGN_NAME | STATUS | ADOFFER_ID | CHANNEL_ID |
+---------------------+--------------+-------------+---------------+--------+------------+------------+
| 8-ios|qdao22-enable | 8-ios|qdao22 | 8 | ios|qdao22 | enable | 7 | 3 |
+---------------------+--------------+-------------+---------------+--------+------------+------------+
2.
mysql> select * from view_label_tab_campaign where CAMPAIGN_ID like '%2%' or CAMPAIGN_NAME like '%2%' ;
+---------------------------+--------------------+-------------+-----------------+--------+------------+------------+
| CampListLabel | CampLabel | CAMPAIGN_ID | CAMPAIGN_NAME | STATUS | ADOFFER_ID | CHANNEL_ID |
+---------------------------+--------------------+-------------+-----------------+--------+------------+------------+
| 2-ios|qudao-active | 2-ios|qudao | 2 | ios|qudao | active | 1 | 1 |
| 8-ios|qdao22-enable | 8-ios|qdao22 | 8 | ios|qdao22 | enable | 7 | 3 |
| 12-放置奇兵|PP助手-active | 12-放置奇兵|PP助手 | 12 | 放置奇兵|PP助手 | active | 13 | 7 |
+---------------------------+--------------------+-------------+-----------------+--------+------------+------------+
3 rows in set
3.
mysql> select * from view_label_tab_campaign where CAMPAIGN_ID like '%2%' or CAMPAIGN_NAME like '%2%' and ADOFFER_ID=1;
+---------------------------+--------------------+-------------+-----------------+--------+------------+------------+
| CampListLabel | CampLabel | CAMPAIGN_ID | CAMPAIGN_NAME | STATUS | ADOFFER_ID | CHANNEL_ID |
+---------------------------+--------------------+-------------+-----------------+--------+------------+------------+
| 2-ios|qudao-active | 2-ios|qudao | 2 | ios|qudao | active | 1 | 1 |
| 12-放置奇兵|PP助手-active | 12-放置奇兵|PP助手 | 12 | 放置奇兵|PP助手 | active | 13 | 7 |
+---------------------------+--------------------+-------------+-----------------+--------+------------+------------+
4. 解决方案是,将一组或语句使用小括号括起来,然后再和其他语句进行与操作!