select count(*)
from tbl_sh_ioproduct ship
inner join tbl_complex_productmakestep pstep on pstep.product_id = sh_iopt_product_sid
and pstep.step_id = ship.sh_iopt_step_sid
WHERE (
select pms.step_id from tbl_complex_productmakestep pms
where pms.product_id = sh_iopt_product_sid and pms.PXZD > pstep.PXZD
order by pms.PXZD
limit 1
) = 10就是一个表中的一个字段值(step_id)等于另一个表的顺序大(pxzd)的第一个的step_id
及所有相关表的 show index from tabl1