Page 1 of 1

CROSS APPLY in dotconnect for MySql

Posted: Tue 25 Aug 2009 14:42
by dilbert
Hello again,
another bug in dotConnect for MySQL 5.40.39

Following query (that is simplified and therefore meaningless):

Code: Select all

from eq in DB.ExamQuestions
from eqe in DB.ExamQuestionExplanations.Where(eqe => eq.Id_explanation == eqe.Id)
from ef in DB.ExamFigures.Where(ef => eq.Id == ef.Id_question).DefaultIfEmpty()
select new { eq.Id }
is translated into this SQL code:

Code: Select all

SELECT t1.Id
FROM db.exam_question t1
CROSS APPLY (
    SELECT NULL 
    FROM db.exam_question_explanation t3
    WHERE t1.Id_explanation = t3.Id
    ) t2
LEFT OUTER JOIN db.exam_figure t4 ON t1.Id = t4.Id_question
that throws exception because CROSS APPLY is not valid MySql clause. It's clause from T-SQL.

Thanks.

Posted: Wed 26 Aug 2009 15:32
by Shalex
We cannot translate such query without CROSS APPLY which is not supported by the server. Please try to redesign your query.