标签:
1、当一个表需要和另外的表链接时,需要连接的对应数据为多条时,先对这些多条数据进行处理
left join (SELECT RESERVATION_ID,COUNT(RESERVATION_ID) attentionsum FROM B_ATTENTION WHERE STATE=1 GROUP BY RESERVATION_ID ) c on a.RESERVATION_ID=c.RESERVATION_ID
2、模糊查询
1 and ( 2 (b.NAME like ‘%${SearchText}%‘) 3 or 4 (a.ADDRESS like ‘%${SearchText}%‘) 5 )
3、可选条件
1 where 2 1=1 3 <if test="MEMBER_ID != ‘‘ and MEMBER_ID != null"> 4 and 5 MEMBER_ID = #{MEMBER_ID} 6 </if>
标签:
原文地址:http://www.cnblogs.com/xyt-0412/p/4608505.html