$stcount = M("Results_all")->alias('a') ->join("s_test_name as b on a.subject = b.sid and a.testsets = b.number",'left') ->where("a.subject = $subject and b.name = '$testsname' ")->field("count(a.number) as cnum") ->select();