SELECT * FROM table1 t1 WHERE 1=1 and
t1_id in (select table1_id from table2 t2 where 1=1 and (t2.t2_name like '%wangwu%' or t1.t1_name like '%zhansan%') );
table1
+---------------------+
| t1_id | t1_name |
+---------------------+
| 100 | zhansan |
+---------------------+
table2
+----------------------------------+
| t2_id | t2_name | table1_id |
+--------------------------------------+
| 200 | wangwu | 100 |
+---------------------------------------+
胡说叔叔
达令说
qq_遁去的一_1
相关分类