<selectid="verifyToAdjust"resultType="java.lang.Integer"> SELECT count(*) from inventory i join cyclecount_detail c on i.id = c.inventoryId WHERE i.qty != c.systemQty and c.headId = #{headId}</select><selectid="verifyToAdjust2"resultType="java.lang.Integer">
SELECT count(*) from ( SELECT * from cyclecount_detail where inventoryId is not null and headId = #{headId}) t WHERE t.inventoryId not in (SELECT id from inventory);