sql like模糊查询的条件拼接

时间:2017-12-26 21:42:13   收藏:0   阅读:707
 

被坑了两次,记录加深记忆

oracle :

  select * from table_name where 1=1 

 <#if secondName?? && secondName?has_content> 

  and second_name like ‘%‘||:secondName||‘%‘

</#if>

 

mysql:

 select * from table_name where 1=1 

 <#if secondName?? && secondName?has_content> 

  and second_name like concat(‘%‘, :second_name ,‘%‘)

</#if>

原文:https://www.cnblogs.com/dudadi/p/8120056.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!