有些业务逻辑并非只能通过Java代码实现,巧用临时表也可以的。

demo:

<select id="getTest" resultType="java.lang.String">

    select  * into #TEMPTable from Table where a = #{a}

    select c from #TEMPTable where b = #{b}

    drop table #TEMPTable

</select>