SELECT min (maxrank) as minofmaxrank FROM (SELECT max(rank) as maxrank FROM tbl_core_staff WHERE st_ymd<=now() AND ed_ymd>now() AND staff_cd in ('','','','','','','','','','','','','','','','','','','') GROUP BY staff_cd ) t1 这里是先从tbl_core_staff 表查询…