一般的,如果1张表的ID是1个字段,当我们要在b表中查询a表ID的数据时,可以这样写:
select * from TableA as a left TableB as b on a.id = b.id
如果,
d表中的ID有2个字段组成,borrowApplyId和currentPeriod。
e表中的ID也是2个字段组成,borrowApplyId和currentPeriod。
这时要查询必须要借助CONCAT函数。
如下图所示
WHERE 1=1 and CONCAT(d.borrow_apply_id,d.current_period) in (SELECT CONCAT(borrow_apply_id ,current_period) from fm_clearing_detail as e WHERE e.clearing_id = #{clearingId,jdbcType=CHAR})