左连接不适用于Web服务器

时间:2013-04-18 15:34:57

标签: php mysql join

以下sql查询在localhost中工作,当我在Web服务器上尝试它时它无法正常工作。

SELECT  t1.student_id,t1.id AS id1,t2.id AS id2,t3.id AS id3,t1.costperhour AS cs1,t2.costperhour AS cs2,t3.costperhour AS cs3,t1.sub_hours AS th1,t2.sub_hours AS th2,t3.sub_hours AS th3,MIN(t1.subjectass_id) AS sub1,MIN(t2.subjectass_id) AS sub2,MIN(t3.subjectass_id) AS sub3    FROM    tb_adhocdetails t1
        LEFT JOIN tb_adhocdetails T2 
            ON t1.student_id = t2.student_id 
            AND t2.subjectass_id > t1.subjectass_id
        LEFT JOIN tb_adhocdetails T3 
            ON t2.student_id = t3.student_id
            AND t3.subjectass_id > t2.subjectass_id
        LEFT JOIN tb_adhocdetails T4 
            ON t3.student_id= t4.student_id
            AND t4.subjectass_id > t3.subjectass_id
WHERE t1.student_id=360

1 个答案:

答案 0 :(得分:0)

在某些Linux MySQL服务器上,表/列名称区分大小写。当您使用大写“T”声明表并使用小写“t”时,您可能会因无法识别的表而出错