jOIyxVfC(提问者)SELECT tc_sgb11,tc_sgb01,tc_sgb02,ima02,tc_xeaud13,ta_ima076,tc_xea22,tc_xeaud13-ta_ima076-7,ta_ima204
FROM tc_sgb_file LEFT JOIN abc.ima_file ON tc_sgb02=ima01 LEFT JOIN tc_xea_file ON substr(tc_sgb01,1,8)=tc_xea02
WHERE (tc_sgbud02 ='N'OR tc_sgbud02 IS NULL) and (ta_ima204 ='N'OR ta_ima204 IS NULL) AND tc_xeaud13-ta_ima076-7<=tc_xea22