具有内连接问题的Mysql 5.6.12 Group_concat

时间:2013-07-09 12:24:52

标签: mysql inner-join mysql-error-1064 group-concat

早些时候我们曾经使用Mysql版本5.5.27并使用以下查询

 SELECT S.StudentId, 
        SED.StudentEnrollmentDetailsId,
        FirstName, MiddleName, LastName, Address, PermanentAddress,
        GROUP_CONCAT(B.BatchName ORDER BY B.BatchId,B.IsVirtualBatch DESC) AS AllBatch  
 FROM Student S 
 INNER JOIN StudentEnrollmentDetails SED ON SED.StudentId = S.StudentId
 INNER JOIN StudentBatchTxn SBT ON SBT.StudentId = S.StudentId  
 WHERE SED.StudentId = ?
 AND SED.StudentEnrollmentDetailsId = ? AND S.CompanyId = ?

此查询用于正确运行学生是否存在于StudentBatchTxn中。

但现在我们已升级到mysql 5.6.12。相同的查询返回所有列为null的行。

请帮帮忙?

2 个答案:

答案 0 :(得分:2)

答案 1 :(得分:2)

这在5.5.27中真的有效吗?

  • INNER JOIN:当BOTH表中至少有一个匹配项时,返回所有行

你能改变LEFT JOIN中的INNER JOIN吗?

  • LEFT JOIN:返回左表中的所有行,以及右表中匹配的行
相关问题