MYSQL -- 如何进行sql like (sql查询结果)的查询

MYSQL如何进行sql like (sql查询结果)的查询 

 1 create_date like CONCAT('%','2018-04-21','%');  #可以避免sql注入。
 2 create_date like '%2018-04-21%';
 3 
 4 select * from table1 where `text` like (select name from table2 where id =3);
 5 select * from table1 where `text` like '%'(select name from table2 where id =3)'%';
 6 select * from table1 where `text` like '%' + (select name from table2 where id =3) +'%';
 7 select * from table1 where `text` like '%(select name from table2 where id =3)%';
 8 select * from table1 where `text` like '%’select name from table2 where id =3‘%';
 9 
10 select * from table1 where `text` like '%(
11 select name from table2 where id =3
12 ) +'%';(第二条SQL单独占一行)

 

posted @ 2018-04-21 16:24  liuweipcs  阅读(670)  评论(0)    收藏  举报