TP多条件查询

$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();

原文地址:https://www.cnblogs.com/lovebing/p/7639783.html